Initial commit
This commit is contained in:
98
package/libs/elfutils/Makefile
Normal file
98
package/libs/elfutils/Makefile
Normal file
@@ -0,0 +1,98 @@
|
||||
#
|
||||
# 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.177
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
|
||||
PKG_SOURCE_URL:=https://sourceware.org/$(PKG_NAME)/ftp/$(PKG_VERSION)
|
||||
PKG_HASH:=fa489deccbcae7d8c920f60d85906124c1989c591196d90e0fd668e3dc05042e
|
||||
PKG_MAINTAINER:=Luiz Angelo Daros de Luca <luizluca@gmail.com>
|
||||
PKG_LICENSE:=GPL-3.0+
|
||||
PKG_LICENSE_FILES:=COPYING COPYING-GPLV2 COPYING-LGPLV3
|
||||
PKG_CPE_ID:=cpe:/a:elfutils_project:elfutils
|
||||
PKG_FIXUP:=autoreconf
|
||||
|
||||
PKG_INSTALL:=1
|
||||
PKG_USE_MIPS16:=0
|
||||
|
||||
PKG_BUILD_DEPENDS:=USE_UCLIBC:argp-standalone USE_MUSL: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
|
||||
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
|
||||
|
||||
CONFIGURE_ARGS += \
|
||||
--program-prefix=eu- \
|
||||
--without-lzma
|
||||
|
||||
TARGET_CFLAGS += -D_GNU_SOURCE -Wno-unused-result -Wno-format-nonliteral
|
||||
|
||||
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
|
||||
|
||||
$(eval $(call BuildPackage,libasm))
|
||||
$(eval $(call BuildPackage,libdw))
|
||||
$(eval $(call BuildPackage,libelf))
|
||||
@@ -0,0 +1,72 @@
|
||||
--- a/libelf/libelfP.h
|
||||
+++ b/libelf/libelfP.h
|
||||
@@ -39,6 +39,9 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
+#ifdef _ /* fix libintl-stub */
|
||||
+#undef _
|
||||
+#endif
|
||||
/* gettext helper macros. */
|
||||
#define _(Str) dgettext ("elfutils", Str)
|
||||
|
||||
--- a/libdw/libdwP.h
|
||||
+++ b/libdw/libdwP.h
|
||||
@@ -35,7 +35,9 @@
|
||||
#include <libdw.h>
|
||||
#include <dwarf.h>
|
||||
|
||||
-
|
||||
+#ifdef _ /* fix libintl-stub */
|
||||
+#undef _
|
||||
+#endif
|
||||
/* gettext helper macros. */
|
||||
#define _(Str) dgettext ("elfutils", Str)
|
||||
|
||||
--- a/libdwfl/libdwflP.h
|
||||
+++ b/libdwfl/libdwflP.h
|
||||
@@ -43,6 +43,9 @@
|
||||
|
||||
typedef struct Dwfl_Process Dwfl_Process;
|
||||
|
||||
+#ifdef _ /* fix libintl-stub */
|
||||
+#undef _
|
||||
+#endif
|
||||
/* gettext helper macros. */
|
||||
#define _(Str) dgettext ("elfutils", Str)
|
||||
|
||||
--- a/libasm/libasmP.h
|
||||
+++ b/libasm/libasmP.h
|
||||
@@ -35,6 +35,9 @@
|
||||
|
||||
#include "libdwelf.h"
|
||||
|
||||
+#ifdef _ /* fix libintl-stub */
|
||||
+#undef _
|
||||
+#endif
|
||||
/* gettext helper macros. */
|
||||
#define _(Str) dgettext ("elfutils", Str)
|
||||
|
||||
--- 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
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -543,6 +543,9 @@ AC_CONFIG_FILES([config/libelf.pc config
|
||||
AC_SUBST(USE_NLS, yes)
|
||||
AM_PO_SUBDIRS
|
||||
|
||||
+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>])
|
||||
12
package/libs/elfutils/patches/005-build_only_libs.patch
Normal file
12
package/libs/elfutils/patches/005-build_only_libs.patch
Normal file
@@ -0,0 +1,12 @@
|
||||
--- a/Makefile.am
|
||||
+++ b/Makefile.am
|
||||
@@ -27,8 +27,7 @@ AM_MAKEFLAGS = --no-print-directory
|
||||
pkginclude_HEADERS = version.h
|
||||
|
||||
# Add doc back when we have some real content.
|
||||
-SUBDIRS = config m4 lib libelf libebl libdwelf libdwfl libdw libcpu libasm \
|
||||
- backends src po tests
|
||||
+SUBDIRS = config m4 lib libelf libebl libdwelf libdwfl libdw libasm
|
||||
|
||||
EXTRA_DIST = elfutils.spec GPG-KEY NOTES CONTRIBUTING \
|
||||
COPYING COPYING-GPLV2 COPYING-LGPLV3
|
||||
64
package/libs/elfutils/patches/100-musl-compat.patch
Normal file
64
package/libs/elfutils/patches/100-musl-compat.patch
Normal file
@@ -0,0 +1,64 @@
|
||||
https://sourceware.org/bugzilla/show_bug.cgi?id=21002
|
||||
|
||||
--- a/lib/system.h
|
||||
+++ b/lib/system.h
|
||||
@@ -30,7 +30,18 @@
|
||||
#define LIB_SYSTEM_H 1
|
||||
|
||||
#include <errno.h>
|
||||
-#include <error.h>
|
||||
+#ifdef HAVE_ERROR_H
|
||||
+#include "error.h"
|
||||
+#else
|
||||
+#include "err.h"
|
||||
+#include <stdio.h>
|
||||
+#define error(status, errno, ...) \
|
||||
+ do { \
|
||||
+ fflush(stdout); \
|
||||
+ warn(__VA_ARGS__); \
|
||||
+ if (status) exit(status); \
|
||||
+ } while(0)
|
||||
+#endif
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/param.h>
|
||||
@@ -38,6 +49,10 @@
|
||||
#include <byteswap.h>
|
||||
#include <unistd.h>
|
||||
|
||||
+#ifndef __GLIBC__
|
||||
+#define canonicalize_file_name(name) realpath(name,NULL)
|
||||
+#endif
|
||||
+
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
# define LE32(n) (n)
|
||||
# define LE64(n) (n)
|
||||
--- a/libdw/libdw_alloc.c
|
||||
+++ b/libdw/libdw_alloc.c
|
||||
@@ -73,5 +73,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
|
||||
@@ -140,6 +140,7 @@ __libdwfl_seterrno (Dwfl_Error error)
|
||||
const char *
|
||||
dwfl_errmsg (int error)
|
||||
{
|
||||
+ static __thread char s[64] = "";
|
||||
if (error == 0 || error == -1)
|
||||
{
|
||||
int last_error = global_error;
|
||||
@@ -154,7 +155,8 @@ dwfl_errmsg (int error)
|
||||
switch (error &~ 0xffff)
|
||||
{
|
||||
case OTHER_ERROR (ERRNO):
|
||||
- return strerror_r (error & 0xffff, "bad", 0);
|
||||
+ strerror_r (error & 0xffff, s, sizeof(s));
|
||||
+ return s;
|
||||
case OTHER_ERROR (LIBELF):
|
||||
return elf_errmsg (error & 0xffff);
|
||||
case OTHER_ERROR (LIBDW):
|
||||
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
|
||||
@@ -56,9 +56,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 }
|
||||
@@ -85,15 +82,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
|
||||
{
|
||||
@@ -226,43 +214,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
|
||||
@@ -49,7 +49,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 \
|
||||
Reference in New Issue
Block a user