Removed sys/cdefs usage. The header is deprecated.
Removed canonicalize_file_name define. It's already fixed upstream.
Added --disable-debuginfod. Seems to be needed.
Modified patch 005 to build more stuff. It was failing before. It still
only builds libraries.
Modified patch 100 to use strerror under non-glibc. It is used under
glibc as strerror is not thread safe. It is under musl and uClibc-ng.
strerror_l is not available under uClibc-ng.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
include $(TOPDIR)/rules.mk
PKG_NAME:=elfutils
-PKG_VERSION:=0.177
-PKG_RELEASE:=2
+PKG_VERSION:=0.179
+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_HASH:=25a545566cbacaa37ae6222e58f1c48ea4570f53ba991886e2f5ce96e22a23a2
PKG_MAINTAINER:=Luiz Angelo Daros de Luca <luizluca@gmail.com>
PKG_LICENSE:=GPL-3.0-or-later
CONFIGURE_ARGS += \
--program-prefix=eu- \
+ --disable-debuginfod \
--without-lzma
TARGET_CFLAGS += -D_GNU_SOURCE -Wno-unused-result -Wno-format-nonliteral
---- a/libelf/libelfP.h
-+++ b/libelf/libelfP.h
-@@ -39,6 +39,9 @@
- #include <stdio.h>
- #include <string.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 @intl_LDFLAGS@
+ Cflags: -I${includedir}
+
+ Requires.private: zlib
+--- a/configure.ac
++++ b/configure.ac
+@@ -586,6 +586,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>])
+--- a/libasm/libasmP.h
++++ b/libasm/libasmP.h
+@@ -36,6 +36,9 @@
+
+ #include "libdwelf.h"
+#ifdef _ /* fix libintl-stub */
+#undef _
--- a/libdw/libdwP.h
+++ b/libdw/libdwP.h
-@@ -35,7 +35,9 @@
- #include <libdw.h>
+@@ -37,6 +37,9 @@
#include <dwarf.h>
+ #include "atomics.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 @@
+@@ -44,6 +44,9 @@
typedef struct Dwfl_Process Dwfl_Process;
/* gettext helper macros. */
#define _(Str) dgettext ("elfutils", Str)
---- a/libasm/libasmP.h
-+++ b/libasm/libasmP.h
-@@ -35,6 +35,9 @@
-
- #include "libdwelf.h"
+--- a/libelf/libelfP.h
++++ b/libelf/libelfP.h
+@@ -39,6 +39,9 @@
+ #include <stdio.h>
+ #include <string.h>
+#ifdef _ /* fix libintl-stub */
+#undef _
/* 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>])
--- a/Makefile.am
+++ b/Makefile.am
-@@ -27,8 +27,7 @@ AM_MAKEFLAGS = --no-print-directory
+@@ -27,7 +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
+ SUBDIRS = config m4 lib libelf libcpu backends libebl libdwelf libdwfl libdw \
+- libasm src po doc tests
++ libasm
- EXTRA_DIST = elfutils.spec GPG-KEY NOTES CONTRIBUTING \
- COPYING COPYING-GPLV2 COPYING-LGPLV3
+ if DEBUGINFOD
+ SUBDIRS += debuginfod
#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
+@@ -147,5 +147,5 @@ __attribute ((noreturn)) attribute_hidde
__libdw_oom (void)
{
while (1)
}
--- a/libdwfl/dwfl_error.c
+++ b/libdwfl/dwfl_error.c
-@@ -154,7 +154,7 @@ dwfl_errmsg (int error)
+@@ -154,7 +154,11 @@ dwfl_errmsg (int error)
switch (error &~ 0xffff)
{
case OTHER_ERROR (ERRNO):
-- return strerror_r (error & 0xffff, "bad", 0);
-+ return strerror_l (error & 0xffff, LC_GLOBAL_LOCALE);
++#if defined(__GLIBC__) && !defined(__UCLIBC__)
+ return strerror_r (error & 0xffff, "bad", 0);
++#else
++ return strerror (error & 0xffff);
++#endif
case OTHER_ERROR (LIBELF):
return elf_errmsg (error & 0xffff);
case OTHER_ERROR (LIBDW):
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
+@@ -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 \
--- /dev/null
+From e399540ab67ffe83ca3c4cb768a2f0f2f32a9057 Mon Sep 17 00:00:00 2001
+From: Rosen Penev <rosenp@gmail.com>
+Date: Sun, 5 Apr 2020 15:56:59 -0700
+Subject: [PATCH] libelf: remove usage of sys/cdefs
+
+sys/cdefs is a deprecated glibc header that is unavailable with other
+libc implementations such as musl.
+
+features.h under glibc includes sys/cdefs whereas it does not under musl.
+
+Signed-off-by: Rosen Penev <rosenp@gmail.com>
+---
+ lib/fixedsizehash.h | 1 -
+ libelf/elf.h | 10 ++++++----
+ 2 files changed, 6 insertions(+), 5 deletions(-)
+
+--- a/lib/fixedsizehash.h
++++ b/lib/fixedsizehash.h
+@@ -30,7 +30,6 @@
+ #include <errno.h>
+ #include <stdlib.h>
+ #include <string.h>
+-#include <sys/cdefs.h>
+
+ #include <system.h>
+
+--- a/libelf/elf.h
++++ b/libelf/elf.h
+@@ -19,9 +19,9 @@
+ #ifndef _ELF_H
+ #define _ELF_H 1
+
+-#include <features.h>
+-
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
+
+ /* Standard ELF types. */
+
+@@ -4007,6 +4007,8 @@ enum
+ #define R_NDS32_TLS_TPOFF 102
+ #define R_NDS32_TLS_DESC 119
+
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
+
+ #endif /* elf.h */