Initial commit
Some checks failed
Build Kernel / Build all affected Kernels (push) Has been cancelled
Build all core packages / Build all core packages for selected target (push) Has been cancelled
Build and Push prebuilt tools container / Build and Push all prebuilt containers (push) Has been cancelled
Build Toolchains / Build Toolchains for each target (push) Has been cancelled
Build host tools / Build host tools for linux and macos based systems (push) Has been cancelled
Coverity scan build / Coverity x86/64 build (push) Has been cancelled
Some checks failed
Build Kernel / Build all affected Kernels (push) Has been cancelled
Build all core packages / Build all core packages for selected target (push) Has been cancelled
Build and Push prebuilt tools container / Build and Push all prebuilt containers (push) Has been cancelled
Build Toolchains / Build Toolchains for each target (push) Has been cancelled
Build host tools / Build host tools for linux and macos based systems (push) Has been cancelled
Coverity scan build / Coverity x86/64 build (push) Has been cancelled
This commit is contained in:
126
package/libs/elfutils/Makefile
Normal file
126
package/libs/elfutils/Makefile
Normal file
@@ -0,0 +1,126 @@
|
||||
#
|
||||
# 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
|
||||
|
||||
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))
|
||||
@@ -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>])
|
||||
11
package/libs/elfutils/patches/005-build_only_libs.patch
Normal file
11
package/libs/elfutils/patches/005-build_only_libs.patch
Normal file
@@ -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
|
||||
@@ -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. */
|
||||
@@ -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
|
||||
@@ -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}
|
||||
@@ -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,
|
||||
29
package/libs/elfutils/patches/100-musl-compat.patch
Normal file
29
package/libs/elfutils/patches/100-musl-compat.patch
Normal file
@@ -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 *
|
||||
83
package/libs/elfutils/patches/101-no-fts.patch
Normal file
83
package/libs/elfutils/patches/101-no-fts.patch
Normal file
@@ -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 \
|
||||
@@ -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);
|
||||
Reference in New Issue
Block a user