ASR_BASE
Change-Id: Icf3719cc0afe3eeb3edc7fa80a2eb5199ca9dda1
diff --git a/package/libs/elfutils/Makefile b/package/libs/elfutils/Makefile
new file mode 100644
index 0000000..8446445
--- /dev/null
+++ b/package/libs/elfutils/Makefile
@@ -0,0 +1,128 @@
+#
+# Copyright (C) 2010-2019 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=elfutils
+PKG_VERSION:=0.192
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=https://sourceware.org/$(PKG_NAME)/ftp/$(PKG_VERSION) \
+ https://mirrors.kernel.org/sourceware/$(PKG_NAME)/$(PKG_VERSION)
+PKG_HASH:=616099beae24aba11f9b63d86ca6cc8d566d968b802391334c91df54eab416b4
+
+PKG_MAINTAINER:=Luiz Angelo Daros de Luca <luizluca@gmail.com>
+PKG_LICENSE:=GPL-3.0-or-later
+PKG_LICENSE_FILES:=COPYING COPYING-GPLV2 COPYING-LGPLV3
+PKG_CPE_ID:=cpe:/a:elfutils_project:elfutils
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+PKG_BUILD_DEPENDS:=!USE_GLIBC:argp-standalone
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+define Package/elfutils/Default
+ SECTION:=libs
+ CATEGORY:=Libraries
+ TITLE:=ELF manipulation libraries
+ URL:=https://fedorahosted.org/elfutils/
+ ABI_VERSION:=1
+endef
+
+define Package/libasm
+ $(call Package/elfutils/Default)
+ TITLE+= (libasm)
+ DEPENDS:=+libelf +libdw
+endef
+
+define Package/libdw
+ $(call Package/elfutils/Default)
+ DEPENDS:=+libelf +libbz2 +USE_MUSL:musl-fts
+ TITLE+= (libdw)
+endef
+
+define Package/libelf
+ $(call Package/elfutils/Default)
+ DEPENDS:=$(INTL_DEPENDS) +zlib
+ TITLE+= (libelf)
+ PROVIDES:=libelf1
+endef
+
+ifeq ($(CONFIG_BUILD_NLS),y)
+TARGET_LDFLAGS += -lintl
+else
+CONFIGURE_ARGS += --disable-nls
+endif
+
+HOST_CONFIGURE_ARGS += \
+ --disable-shared \
+ --disable-nls \
+ --disable-debuginfod \
+ --disable-libdebuginfod \
+ --without-bzlib \
+ --without-lzma \
+ --without-zstd
+
+CONFIGURE_ARGS += \
+ --program-prefix=eu- \
+ --disable-debuginfod \
+ --disable-libdebuginfod \
+ --without-bzlib \
+ --without-lzma \
+ --without-zstd
+
+HOST_CONFIGURE_VARS += \
+ ac_cv_search__obstack_free=yes
+
+CONFIGURE_VARS += \
+ ac_cv_search__obstack_free=yes
+
+TARGET_CFLAGS += \
+ -D_GNU_SOURCE \
+ -Wno-unused-result \
+ -Wno-format-nonliteral
+
+TARGET_CPPFLAGS += -DHAVE_ERR_H
+
+ifneq ($(CONFIG_GCC_USE_VERSION_11),y)
+TARGET_CFLAGS += \
+ -Wno-error=use-after-free
+endif
+
+define Build/InstallDev
+ $(INSTALL_DIR) $(1)/usr/include
+ $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
+ $(INSTALL_DIR) $(1)/usr/lib
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/libasm*.{a,so*} $(1)/usr/lib/
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/libdw*.{a,so*} $(1)/usr/lib/
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/libelf*.{a,so*} $(1)/usr/lib/
+ $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libelf.pc $(1)/usr/lib/pkgconfig/
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libdw.pc $(1)/usr/lib/pkgconfig/
+endef
+
+define Package/libasm/install
+ $(INSTALL_DIR) $(1)/usr/lib
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/libasm{-*.so,*.so.*} $(1)/usr/lib/
+endef
+
+define Package/libdw/install
+ $(INSTALL_DIR) $(1)/usr/lib
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/libdw{-*.so,*.so.*} $(1)/usr/lib/
+endef
+
+define Package/libelf/install
+ $(INSTALL_DIR) $(1)/usr/lib
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/libelf{-*.so,*.so.*} $(1)/usr/lib/
+endef
+
+# these lines need to be ordered by dependency because of ABI versioning
+$(eval $(call BuildPackage,libelf))
+$(eval $(call BuildPackage,libdw))
+$(eval $(call BuildPackage,libasm))
diff --git a/package/libs/elfutils/patches/003-libintl-compatibility.patch b/package/libs/elfutils/patches/003-libintl-compatibility.patch
new file mode 100644
index 0000000..eda9f22
--- /dev/null
+++ b/package/libs/elfutils/patches/003-libintl-compatibility.patch
@@ -0,0 +1,23 @@
+--- 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 @intl_LDFLAGS@
+ Cflags: -I${includedir}
+
+ Requires.private: zlib @LIBZSTD@
+--- a/configure.ac
++++ b/configure.ac
+@@ -728,6 +728,9 @@ dnl AM_GNU_GETTEXT_REQUIRE_VERSION suppo
+ AM_GNU_GETTEXT_VERSION([0.19.6])
+ AM_GNU_GETTEXT_REQUIRE_VERSION([0.19.6])
+
++case "$USE_NLS" in yes) intl_LDFLAGS="-lintl" ;; esac
++AC_SUBST([intl_LDFLAGS])
++
+ dnl Appended to the config.h file.
+ dnl We hide all kinds of configuration magic in lib/eu-config.h.
+ AH_BOTTOM([#include <eu-config.h>])
diff --git a/package/libs/elfutils/patches/005-build_only_libs.patch b/package/libs/elfutils/patches/005-build_only_libs.patch
new file mode 100644
index 0000000..177ac65
--- /dev/null
+++ b/package/libs/elfutils/patches/005-build_only_libs.patch
@@ -0,0 +1,11 @@
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -27,7 +27,7 @@ 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
++ libasm
+
+ EXTRA_DIST = elfutils.spec GPG-KEY NOTES CONTRIBUTING SECURITY \
+ COPYING COPYING-GPLV2 COPYING-LGPLV3 CONDUCT
diff --git a/package/libs/elfutils/patches/006-Fix-build-on-aarch64-musl.patch b/package/libs/elfutils/patches/006-Fix-build-on-aarch64-musl.patch
new file mode 100644
index 0000000..a7786ed
--- /dev/null
+++ b/package/libs/elfutils/patches/006-Fix-build-on-aarch64-musl.patch
@@ -0,0 +1,55 @@
+From 578f370c7e7a9f056aefa062b34590b0aa13bce5 Mon Sep 17 00:00:00 2001
+From: Hongxu Jia <hongxu.jia@windriver.com>
+Date: Tue, 15 Aug 2017 17:27:30 +0800
+Subject: [PATCH] Fix build on aarch64/musl
+
+Errors
+
+invalid operands to binary & (have 'long double' and 'unsigned int')
+
+error: redefinition
+ of 'struct iovec'
+ struct iovec { void *iov_base; size_t iov_len; };
+ ^
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+Rebase to 0.170
+Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
+
+---
+ backends/aarch64_initreg.c | 4 ++--
+ backends/arm_initreg.c | 2 +-
+ 2 files changed, 3 insertions(+), 3 deletions(-)
+
+--- a/backends/aarch64_initreg.c
++++ b/backends/aarch64_initreg.c
+@@ -33,7 +33,7 @@
+ #include "system.h"
+ #include <assert.h>
+ #if defined(__aarch64__) && defined(__linux__)
+-# include <linux/uio.h>
++# include <sys/uio.h>
+ # include <sys/user.h>
+ # include <sys/ptrace.h>
+ # include <asm/ptrace.h>
+@@ -94,7 +94,7 @@ aarch64_set_initial_registers_tid (pid_t
+
+ Dwarf_Word dwarf_fregs[32];
+ for (int r = 0; r < 32; r++)
+- dwarf_fregs[r] = fregs.vregs[r] & 0xFFFFFFFF;
++ dwarf_fregs[r] = (unsigned int)fregs.vregs[r] & 0xFFFFFFFF;
+
+ if (! setfunc (64, 32, dwarf_fregs, arg))
+ return false;
+--- a/backends/arm_initreg.c
++++ b/backends/arm_initreg.c
+@@ -38,7 +38,7 @@
+ #endif
+
+ #ifdef __aarch64__
+-# include <linux/uio.h>
++# include <sys/uio.h>
+ # include <sys/user.h>
+ # include <sys/ptrace.h>
+ /* Deal with old glibc defining user_pt_regs instead of user_regs_struct. */
diff --git a/package/libs/elfutils/patches/007-add-libeu-symbols-to-libelf.patch b/package/libs/elfutils/patches/007-add-libeu-symbols-to-libelf.patch
new file mode 100644
index 0000000..23489b5
--- /dev/null
+++ b/package/libs/elfutils/patches/007-add-libeu-symbols-to-libelf.patch
@@ -0,0 +1,31 @@
+From f5d6e088f84dd05278c4698a21cbf1ff4569978d Mon Sep 17 00:00:00 2001
+From: Mark Wielaard <mark@klomp.org>
+Date: Tue, 22 Oct 2024 15:03:42 +0200
+Subject: [PATCH] libelf: Add libeu objects to libelf.a static archive
+
+libelf might use some symbols from libeu.a, specifically the eu-search
+wrappers. But we don't ship libeu.a separately. So include the libeu
+objects in the libelf.a archive to facilitate static linking.
+
+ * libelf/Makefile.am (libeu_objects): New variable.
+ (libelf_a_LIBADD): New, add libeu_objects.
+
+https://sourceware.org/bugzilla/show_bug.cgi?id=32293
+
+Signed-off-by: Mark Wielaard <mark@klomp.org>
+---
+ libelf/Makefile.am | 3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/libelf/Makefile.am
++++ b/libelf/Makefile.am
+@@ -122,6 +122,9 @@ libelf.so: $(srcdir)/libelf.map $(libelf
+ @$(textrel_check)
+ $(AM_V_at)ln -fs $@ $@.$(VERSION)
+
++libeu_objects = $(shell $(AR) t ../lib/libeu.a)
++libelf_a_LIBADD = $(addprefix ../lib/,$(libeu_objects))
++
+ install: install-am libelf.so
+ $(mkinstalldirs) $(DESTDIR)$(libdir)
+ $(INSTALL_PROGRAM) libelf.so $(DESTDIR)$(libdir)/libelf-$(PACKAGE_VERSION).so
diff --git a/package/libs/elfutils/patches/008-fix-autoconf-ENABLE_IMA_VERIFICATION.patch b/package/libs/elfutils/patches/008-fix-autoconf-ENABLE_IMA_VERIFICATION.patch
new file mode 100644
index 0000000..e5732d2
--- /dev/null
+++ b/package/libs/elfutils/patches/008-fix-autoconf-ENABLE_IMA_VERIFICATION.patch
@@ -0,0 +1,24 @@
+From f3c664d069d81a4872a1ec8241ee709f37c53e9c Mon Sep 17 00:00:00 2001
+From: Aaron Merey <amerey@redhat.com>
+Date: Tue, 29 Oct 2024 14:16:57 -0400
+Subject: [PATCH] configure.ac: Fix ENABLE_IMA_VERIFICATION conditional
+
+Fix test statement for ENABLE_IMA_VERIFICATION always evalutating to
+false due to a missing 'x'.
+
+Signed-off-by: Aaron Merey <amerey@redhat.com>
+---
+ configure.ac | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/configure.ac
++++ b/configure.ac
+@@ -895,7 +895,7 @@ AS_IF([test "x$enable_debuginfod" != "xn
+ AM_CONDITIONAL([DEBUGINFOD],[test "x$enable_debuginfod" = "xyes"])
+ AS_IF([test "x$enable_debuginfod_ima_verification" = "xyes"],AC_DEFINE([ENABLE_IMA_VERIFICATION],[1],[Build IMA verification]))
+ AS_IF([test "x$have_libarchive" = "xyes"],AC_DEFINE([HAVE_LIBARCHIVE],[1],[Define to 1 if libarchive is available]))
+-AM_CONDITIONAL([ENABLE_IMA_VERIFICATION],[test "$enable_debuginfod_ima_verification" = "xyes"])
++AM_CONDITIONAL([ENABLE_IMA_VERIFICATION],[test "x$enable_debuginfod_ima_verification" = "xyes"])
+ AM_CONDITIONAL([OLD_LIBMICROHTTPD],[test "x$old_libmicrohttpd" = "xyes"])
+
+ dnl for /etc/profile.d/elfutils.{csh,sh}
diff --git a/package/libs/elfutils/patches/009-fix-null-dereference-with-lto.patch b/package/libs/elfutils/patches/009-fix-null-dereference-with-lto.patch
new file mode 100644
index 0000000..1179a1e
--- /dev/null
+++ b/package/libs/elfutils/patches/009-fix-null-dereference-with-lto.patch
@@ -0,0 +1,193 @@
+From 8707194a9f2f0b13e53041b03ebfdbdbd2942e43 Mon Sep 17 00:00:00 2001
+From: Mark Wielaard <mark@klomp.org>
+Date: Tue, 5 Nov 2024 23:31:14 +0100
+Subject: [PATCH 1/1] libelf: Only fetch shdr once in elf_compress[_gnu]
+
+Some compilers assume the second call to elf[32|64]_getshdr can fail
+and produce error: potential null pointer dereference. Just store the
+result of the first call and reuse (when not NULL).
+
+ * libelf/elf_compress.c (elf_compress): Store getshdr result in
+ a shdr union var.
+ * libelf/elf_compress_gnu.c (): Likewise
+
+https://sourceware.org/bugzilla/show_bug.cgi?id=32311
+
+Signed-off-by: Mark Wielaard <mark@klomp.org>
+---
+ libelf/elf_compress.c | 55 +++++++++++++++++++++------------------
+ libelf/elf_compress_gnu.c | 45 ++++++++++++++------------------
+ 2 files changed, 48 insertions(+), 52 deletions(-)
+
+--- a/libelf/elf_compress.c
++++ b/libelf/elf_compress.c
+@@ -584,25 +584,30 @@ elf_compress (Elf_Scn *scn, int type, un
+ Elf64_Xword sh_flags;
+ Elf64_Word sh_type;
+ Elf64_Xword sh_addralign;
++ union shdr
++ {
++ Elf32_Shdr *s32;
++ Elf64_Shdr *s64;
++ } shdr;
+ if (elfclass == ELFCLASS32)
+ {
+- Elf32_Shdr *shdr = elf32_getshdr (scn);
+- if (shdr == NULL)
++ shdr.s32 = elf32_getshdr (scn);
++ if (shdr.s32 == NULL)
+ return -1;
+
+- sh_flags = shdr->sh_flags;
+- sh_type = shdr->sh_type;
+- sh_addralign = shdr->sh_addralign;
++ sh_flags = shdr.s32->sh_flags;
++ sh_type = shdr.s32->sh_type;
++ sh_addralign = shdr.s32->sh_addralign;
+ }
+ else
+ {
+- Elf64_Shdr *shdr = elf64_getshdr (scn);
+- if (shdr == NULL)
++ shdr.s64 = elf64_getshdr (scn);
++ if (shdr.s64 == NULL)
+ return -1;
+
+- sh_flags = shdr->sh_flags;
+- sh_type = shdr->sh_type;
+- sh_addralign = shdr->sh_addralign;
++ sh_flags = shdr.s64->sh_flags;
++ sh_type = shdr.s64->sh_type;
++ sh_addralign = shdr.s64->sh_addralign;
+ }
+
+ if ((sh_flags & SHF_ALLOC) != 0)
+@@ -679,17 +684,17 @@ elf_compress (Elf_Scn *scn, int type, un
+ correctly and ignored when SHF_COMPRESSED is set. */
+ if (elfclass == ELFCLASS32)
+ {
+- Elf32_Shdr *shdr = elf32_getshdr (scn);
+- shdr->sh_size = new_size;
+- shdr->sh_addralign = __libelf_type_align (ELFCLASS32, ELF_T_CHDR);
+- shdr->sh_flags |= SHF_COMPRESSED;
++ shdr.s32->sh_size = new_size;
++ shdr.s32->sh_addralign = __libelf_type_align (ELFCLASS32,
++ ELF_T_CHDR);
++ shdr.s32->sh_flags |= SHF_COMPRESSED;
+ }
+ else
+ {
+- Elf64_Shdr *shdr = elf64_getshdr (scn);
+- shdr->sh_size = new_size;
+- shdr->sh_addralign = __libelf_type_align (ELFCLASS64, ELF_T_CHDR);
+- shdr->sh_flags |= SHF_COMPRESSED;
++ shdr.s64->sh_size = new_size;
++ shdr.s64->sh_addralign = __libelf_type_align (ELFCLASS64,
++ ELF_T_CHDR);
++ shdr.s64->sh_flags |= SHF_COMPRESSED;
+ }
+
+ __libelf_reset_rawdata (scn, out_buf, new_size, 1, ELF_T_CHDR);
+@@ -731,17 +736,15 @@ elf_compress (Elf_Scn *scn, int type, un
+ correctly and ignored when SHF_COMPRESSED is set. */
+ if (elfclass == ELFCLASS32)
+ {
+- Elf32_Shdr *shdr = elf32_getshdr (scn);
+- shdr->sh_size = scn->zdata_size;
+- shdr->sh_addralign = scn->zdata_align;
+- shdr->sh_flags &= ~SHF_COMPRESSED;
++ shdr.s32->sh_size = scn->zdata_size;
++ shdr.s32->sh_addralign = scn->zdata_align;
++ shdr.s32->sh_flags &= ~SHF_COMPRESSED;
+ }
+ else
+ {
+- Elf64_Shdr *shdr = elf64_getshdr (scn);
+- shdr->sh_size = scn->zdata_size;
+- shdr->sh_addralign = scn->zdata_align;
+- shdr->sh_flags &= ~SHF_COMPRESSED;
++ shdr.s64->sh_size = scn->zdata_size;
++ shdr.s64->sh_addralign = scn->zdata_align;
++ shdr.s64->sh_flags &= ~SHF_COMPRESSED;
+ }
+
+ __libelf_reset_rawdata (scn, scn->zdata_base,
+--- a/libelf/elf_compress_gnu.c
++++ b/libelf/elf_compress_gnu.c
+@@ -59,25 +59,30 @@ elf_compress_gnu (Elf_Scn *scn, int infl
+ Elf64_Xword sh_flags;
+ Elf64_Word sh_type;
+ Elf64_Xword sh_addralign;
++ union shdr
++ {
++ Elf32_Shdr *s32;
++ Elf64_Shdr *s64;
++ } shdr;
+ if (elfclass == ELFCLASS32)
+ {
+- Elf32_Shdr *shdr = elf32_getshdr (scn);
+- if (shdr == NULL)
++ shdr.s32 = elf32_getshdr (scn);
++ if (shdr.s32 == NULL)
+ return -1;
+
+- sh_flags = shdr->sh_flags;
+- sh_type = shdr->sh_type;
+- sh_addralign = shdr->sh_addralign;
++ sh_flags = shdr.s32->sh_flags;
++ sh_type = shdr.s32->sh_type;
++ sh_addralign = shdr.s32->sh_addralign;
+ }
+ else
+ {
+- Elf64_Shdr *shdr = elf64_getshdr (scn);
+- if (shdr == NULL)
++ shdr.s64 = elf64_getshdr (scn);
++ if (shdr.s64 == NULL)
+ return -1;
+
+- sh_flags = shdr->sh_flags;
+- sh_type = shdr->sh_type;
+- sh_addralign = shdr->sh_addralign;
++ sh_flags = shdr.s64->sh_flags;
++ sh_type = shdr.s64->sh_type;
++ sh_addralign = shdr.s64->sh_addralign;
+ }
+
+ /* Allocated sections, or sections that are already are compressed
+@@ -122,15 +127,9 @@ elf_compress_gnu (Elf_Scn *scn, int infl
+ sh_flags won't have a SHF_COMPRESSED hint in the GNU format.
+ Just adjust the sh_size. */
+ if (elfclass == ELFCLASS32)
+- {
+- Elf32_Shdr *shdr = elf32_getshdr (scn);
+- shdr->sh_size = new_size;
+- }
++ shdr.s32->sh_size = new_size;
+ else
+- {
+- Elf64_Shdr *shdr = elf64_getshdr (scn);
+- shdr->sh_size = new_size;
+- }
++ shdr.s64->sh_size = new_size;
+
+ __libelf_reset_rawdata (scn, out_buf, new_size, 1, ELF_T_BYTE);
+
+@@ -187,15 +186,9 @@ elf_compress_gnu (Elf_Scn *scn, int infl
+ sh_flags won't have a SHF_COMPRESSED hint in the GNU format.
+ Just adjust the sh_size. */
+ if (elfclass == ELFCLASS32)
+- {
+- Elf32_Shdr *shdr = elf32_getshdr (scn);
+- shdr->sh_size = size;
+- }
++ shdr.s32->sh_size = size;
+ else
+- {
+- Elf64_Shdr *shdr = elf64_getshdr (scn);
+- shdr->sh_size = size;
+- }
++ shdr.s64->sh_size = size;
+
+ __libelf_reset_rawdata (scn, buf_out, size, sh_addralign,
+ __libelf_data_type (&ehdr, sh_type,
diff --git a/package/libs/elfutils/patches/100-musl-compat.patch b/package/libs/elfutils/patches/100-musl-compat.patch
new file mode 100644
index 0000000..3fa095b
--- /dev/null
+++ b/package/libs/elfutils/patches/100-musl-compat.patch
@@ -0,0 +1,29 @@
+--- a/libdw/libdw_alloc.c
++++ b/libdw/libdw_alloc.c
+@@ -152,5 +152,5 @@ __attribute ((noreturn)) attribute_hidde
+ __libdw_oom (void)
+ {
+ while (1)
+- error (EXIT_FAILURE, ENOMEM, "libdw");
++ error (EXIT_FAILURE, errno, gettext ("cannot allocate memory"));
+ }
+--- a/libdwfl/dwfl_error.c
++++ b/libdwfl/dwfl_error.c
+@@ -139,6 +139,7 @@ __libdwfl_seterrno (Dwfl_Error error)
+ static const char *
+ errnomsg(int error)
+ {
++#if defined(__GLIBC__) && !defined(__UCLIBC__)
+ /* Won't be changed by strerror_r, but not const so compiler doesn't throw warning */
+ static char unknown[] = "unknown error";
+
+@@ -149,6 +150,9 @@ errnomsg(int error)
+ static __thread char msg[128];
+ return strerror_r (error, msg, sizeof (msg)) ? unknown : msg;
+ #endif
++#else
++ return strerror (error & 0xffff);
++#endif
+ }
+
+ const char *
diff --git a/package/libs/elfutils/patches/101-no-fts.patch b/package/libs/elfutils/patches/101-no-fts.patch
new file mode 100644
index 0000000..29a6c4b
--- /dev/null
+++ b/package/libs/elfutils/patches/101-no-fts.patch
@@ -0,0 +1,83 @@
+--- a/libdwfl/argp-std.c
++++ b/libdwfl/argp-std.c
+@@ -51,9 +51,6 @@ static const struct argp_option options[
+ { "linux-process-map", 'M', "FILE", 0,
+ N_("Find addresses in files mapped as read from FILE"
+ " in Linux /proc/PID/maps format"), 0 },
+- { "kernel", 'k', NULL, 0, N_("Find addresses in the running kernel"), 0 },
+- { "offline-kernel", 'K', "RELEASE", OPTION_ARG_OPTIONAL,
+- N_("Kernel with all modules"), 0 },
+ { "debuginfo-path", OPT_DEBUGINFO, "PATH", 0,
+ N_("Search path for separate debuginfo files"), 0 },
+ { NULL, 0, NULL, 0, NULL, 0 }
+@@ -80,15 +77,6 @@ static const Dwfl_Callbacks proc_callbac
+ .find_elf = INTUSE(dwfl_linux_proc_find_elf),
+ };
+
+-static const Dwfl_Callbacks kernel_callbacks =
+- {
+- .find_debuginfo = INTUSE(dwfl_standard_find_debuginfo),
+- .debuginfo_path = &debuginfo_path,
+-
+- .find_elf = INTUSE(dwfl_linux_kernel_find_elf),
+- .section_address = INTUSE(dwfl_linux_kernel_module_section_address),
+- };
+-
+ /* Structure held at state->HOOK. */
+ struct parse_opt
+ {
+@@ -221,43 +209,6 @@ parse_opt (int key, char *arg, struct ar
+ }
+ break;
+
+- case 'k':
+- {
+- struct parse_opt *opt = state->hook;
+- if (opt->dwfl == NULL)
+- {
+- Dwfl *dwfl = INTUSE(dwfl_begin) (&kernel_callbacks);
+- int result = INTUSE(dwfl_linux_kernel_report_kernel) (dwfl);
+- if (result != 0)
+- return fail (dwfl, result, _("cannot load kernel symbols"), state);
+- result = INTUSE(dwfl_linux_kernel_report_modules) (dwfl);
+- if (result != 0)
+- /* Non-fatal to have no modules since we do have the kernel. */
+- argp_failure (state, 0, result, _("cannot find kernel modules"));
+- opt->dwfl = dwfl;
+- }
+- else
+- goto toomany;
+- }
+- break;
+-
+- case 'K':
+- {
+- struct parse_opt *opt = state->hook;
+- if (opt->dwfl == NULL)
+- {
+- Dwfl *dwfl = INTUSE(dwfl_begin) (&offline_callbacks);
+- int result = INTUSE(dwfl_linux_kernel_report_offline) (dwfl, arg,
+- NULL);
+- if (result != 0)
+- return fail (dwfl, result, _("cannot find kernel or modules"), state);
+- opt->dwfl = dwfl;
+- }
+- else
+- goto toomany;
+- }
+- break;
+-
+ case ARGP_KEY_SUCCESS:
+ {
+ struct parse_opt *opt = state->hook;
+--- a/libdwfl/Makefile.am
++++ b/libdwfl/Makefile.am
+@@ -50,7 +50,7 @@ libdwfl_a_SOURCES = dwfl_begin.c dwfl_en
+ argp-std.c find-debuginfo.c \
+ dwfl_build_id_find_elf.c \
+ dwfl_build_id_find_debuginfo.c \
+- linux-kernel-modules.c linux-proc-maps.c \
++ linux-proc-maps.c \
+ dwfl_addrmodule.c dwfl_addrdwarf.c \
+ cu.c dwfl_module_nextcu.c dwfl_nextcu.c dwfl_cumodule.c \
+ dwfl_module_addrdie.c dwfl_addrdie.c \
diff --git a/package/libs/elfutils/patches/102-fix-potential-deref-of-null-error.patch b/package/libs/elfutils/patches/102-fix-potential-deref-of-null-error.patch
new file mode 100644
index 0000000..6710e4e
--- /dev/null
+++ b/package/libs/elfutils/patches/102-fix-potential-deref-of-null-error.patch
@@ -0,0 +1,55 @@
+strip.c: Pointer `arhdr` created at strip.c:2741 and then dereferenced without NULL-check.
+The same situation for the `arhdr` pointer at the objdump.c:313 and
+the `h` pointer at the readelf.c:13545.
+
+Triggers found by static analyzer Svace.
+
+Signed-off-by: Maks Mishin <maks.mishinFZ@gmail.com>
+---
+ src/objdump.c | 5 +++++
+ src/readelf.c | 5 +++++
+ src/strip.c | 5 +++++
+ 3 files changed, 15 insertions(+)
+
+--- a/src/objdump.c
++++ b/src/objdump.c
+@@ -311,6 +311,11 @@ handle_ar (int fd, Elf *elf, const char
+ {
+ /* The the header for this element. */
+ Elf_Arhdr *arhdr = elf_getarhdr (subelf);
++ if (arhdr == NULL)
++ {
++ printf ("cannot get arhdr: %s\n", elf_errmsg (-1));
++ exit (1);
++ }
+
+ /* Skip over the index entries. */
+ if (strcmp (arhdr->ar_name, "/") != 0
+--- a/src/readelf.c
++++ b/src/readelf.c
+@@ -13543,6 +13543,11 @@ dump_archive_index (Elf *elf, const char
+ as_off, fname, elf_errmsg (-1));
+
+ const Elf_Arhdr *h = elf_getarhdr (subelf);
++ if (h == NULL)
++ {
++ printf ("cannot get arhdr: %s\n", elf_errmsg (-1));
++ exit (1);
++ }
+
+ printf (_("Archive member '%s' contains:\n"), h->ar_name);
+
+--- a/src/strip.c
++++ b/src/strip.c
+@@ -2739,6 +2739,11 @@ handle_ar (int fd, Elf *elf, const char
+ {
+ /* The the header for this element. */
+ Elf_Arhdr *arhdr = elf_getarhdr (subelf);
++ if (arhdr == NULL)
++ {
++ printf ("cannot get arhdr: %s\n", elf_errmsg (-1));
++ exit (1);
++ }
+
+ if (elf_kind (subelf) == ELF_K_ELF)
+ result |= handle_elf (fd, subelf, new_prefix, arhdr->ar_name, 0, NULL);
diff --git a/package/libs/elfutils/patches/200-fix-build-warning.patch b/package/libs/elfutils/patches/200-fix-build-warning.patch
new file mode 100644
index 0000000..3c48b98
--- /dev/null
+++ b/package/libs/elfutils/patches/200-fix-build-warning.patch
@@ -0,0 +1,10 @@
+--- a/lib/xasprintf.c
++++ b/lib/xasprintf.c
+@@ -30,6 +30,7 @@
+ # include <config.h>
+ #endif
+
++#include <errno.h>
+ #include <stdarg.h>
+ #include <stdio.h>
+ #include <stdlib.h>