diff mbox series

[OpenWrt-Devel] elfutils: update to 0.179

Message ID 20200406020238.3780-1-rosenp@gmail.com
State Accepted
Delegated to: Hauke Mehrtens
Headers show
Series [OpenWrt-Devel] elfutils: update to 0.179 | expand

Commit Message

Rosen Penev April 6, 2020, 2:02 a.m. UTC
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>
---
 package/libs/elfutils/Makefile                |  7 +-
 .../patches/003-libintl-compatibility.patch   | 75 +++++++++----------
 .../patches/005-build_only_libs.patch         | 13 ++--
 .../elfutils/patches/100-musl-compat.patch    | 22 ++----
 .../libs/elfutils/patches/101-no-fts.patch    |  2 +-
 .../libs/elfutils/patches/110-no-cdefs.patch  | 58 ++++++++++++++
 6 files changed, 113 insertions(+), 64 deletions(-)
 create mode 100644 package/libs/elfutils/patches/110-no-cdefs.patch

Comments

Oldřich Jedlička April 6, 2020, 6:01 a.m. UTC | #1
po 6. 4. 2020 v 4:02 odesílatel Rosen Penev <rosenp@gmail.com> napsal:

> 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>
> ---
>  package/libs/elfutils/Makefile                |  7 +-
>  .../patches/003-libintl-compatibility.patch   | 75 +++++++++----------
>  .../patches/005-build_only_libs.patch         | 13 ++--
>  .../elfutils/patches/100-musl-compat.patch    | 22 ++----
>  .../libs/elfutils/patches/101-no-fts.patch    |  2 +-
>  .../libs/elfutils/patches/110-no-cdefs.patch  | 58 ++++++++++++++
>  6 files changed, 113 insertions(+), 64 deletions(-)
>  create mode 100644 package/libs/elfutils/patches/110-no-cdefs.patch
>
> diff --git a/package/libs/elfutils/Makefile
> b/package/libs/elfutils/Makefile
> index 630c48820a..e6868c56f4 100644
> --- a/package/libs/elfutils/Makefile
> +++ b/package/libs/elfutils/Makefile
> @@ -7,12 +7,12 @@
>  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
> <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
> @@ -63,6 +63,7 @@ endif
>
>  CONFIGURE_ARGS += \
>         --program-prefix=eu- \
> +       --disable-debuginfod \
>         --without-lzma
>
>  TARGET_CFLAGS += -D_GNU_SOURCE -Wno-unused-result -Wno-format-nonliteral
> diff --git a/package/libs/elfutils/patches/003-libintl-compatibility.patch
> b/package/libs/elfutils/patches/003-libintl-compatibility.patch
> index 32bfaf8e6d..ea0f4535a5 100644
> --- a/package/libs/elfutils/patches/003-libintl-compatibility.patch
> +++ b/package/libs/elfutils/patches/003-libintl-compatibility.patch
> @@ -1,8 +1,31 @@
> ---- 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 read and write
> ELF files
> + 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/libdw.pc
> config/libdebuginfod.pc])
> + 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 _
> @@ -12,20 +35,19 @@
>
>  --- 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;
>
> @@ -35,11 +57,11 @@
>   /* 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 _
> @@ -47,26 +69,3 @@
>   /* 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>])
> diff --git a/package/libs/elfutils/patches/005-build_only_libs.patch
> b/package/libs/elfutils/patches/005-build_only_libs.patch
> index 93d593a0fc..a81d1d2cab 100644
> --- a/package/libs/elfutils/patches/005-build_only_libs.patch
> +++ b/package/libs/elfutils/patches/005-build_only_libs.patch
> @@ -1,12 +1,11 @@
>  --- 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
> diff --git a/package/libs/elfutils/patches/100-musl-compat.patch
> b/package/libs/elfutils/patches/100-musl-compat.patch
> index 109b7ece08..374e832d3f 100644
> --- a/package/libs/elfutils/patches/100-musl-compat.patch
> +++ b/package/libs/elfutils/patches/100-musl-compat.patch
> @@ -22,20 +22,9 @@ https://sourceware.org/bugzilla/show_bug.cgi?id=21002
>   #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)
> @@ -44,12 +33,15 @@ https://sourceware.org/bugzilla/show_bug.cgi?id=21002
>   }
>  --- 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);
>

According to GNU documentation, this call uses insufficient buffer size
(buflen is 0), so it should lead to error ERANGE. Moreover, supplying fixed
string as a buffer does not look correct, so I doubt this does anything
useful.

Regards,
Oldrich.
Rosen Penev April 6, 2020, 6:45 a.m. UTC | #2
On Sun, Apr 5, 2020 at 11:01 PM Oldřich Jedlička <oldium.pro@gmail.com> wrote:
>
> po 6. 4. 2020 v 4:02 odesílatel Rosen Penev <rosenp@gmail.com> napsal:
>>
>> 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>
>> ---
>>  package/libs/elfutils/Makefile                |  7 +-
>>  .../patches/003-libintl-compatibility.patch   | 75 +++++++++----------
>>  .../patches/005-build_only_libs.patch         | 13 ++--
>>  .../elfutils/patches/100-musl-compat.patch    | 22 ++----
>>  .../libs/elfutils/patches/101-no-fts.patch    |  2 +-
>>  .../libs/elfutils/patches/110-no-cdefs.patch  | 58 ++++++++++++++
>>  6 files changed, 113 insertions(+), 64 deletions(-)
>>  create mode 100644 package/libs/elfutils/patches/110-no-cdefs.patch
>>
>> diff --git a/package/libs/elfutils/Makefile b/package/libs/elfutils/Makefile
>> index 630c48820a..e6868c56f4 100644
>> --- a/package/libs/elfutils/Makefile
>> +++ b/package/libs/elfutils/Makefile
>> @@ -7,12 +7,12 @@
>>  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
>> @@ -63,6 +63,7 @@ endif
>>
>>  CONFIGURE_ARGS += \
>>         --program-prefix=eu- \
>> +       --disable-debuginfod \
>>         --without-lzma
>>
>>  TARGET_CFLAGS += -D_GNU_SOURCE -Wno-unused-result -Wno-format-nonliteral
>> diff --git a/package/libs/elfutils/patches/003-libintl-compatibility.patch b/package/libs/elfutils/patches/003-libintl-compatibility.patch
>> index 32bfaf8e6d..ea0f4535a5 100644
>> --- a/package/libs/elfutils/patches/003-libintl-compatibility.patch
>> +++ b/package/libs/elfutils/patches/003-libintl-compatibility.patch
>> @@ -1,8 +1,31 @@
>> ---- 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 read and write ELF files
>> + 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/libdw.pc config/libdebuginfod.pc])
>> + 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 _
>> @@ -12,20 +35,19 @@
>>
>>  --- 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;
>>
>> @@ -35,11 +57,11 @@
>>   /* 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 _
>> @@ -47,26 +69,3 @@
>>   /* 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>])
>> diff --git a/package/libs/elfutils/patches/005-build_only_libs.patch b/package/libs/elfutils/patches/005-build_only_libs.patch
>> index 93d593a0fc..a81d1d2cab 100644
>> --- a/package/libs/elfutils/patches/005-build_only_libs.patch
>> +++ b/package/libs/elfutils/patches/005-build_only_libs.patch
>> @@ -1,12 +1,11 @@
>>  --- 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
>> diff --git a/package/libs/elfutils/patches/100-musl-compat.patch b/package/libs/elfutils/patches/100-musl-compat.patch
>> index 109b7ece08..374e832d3f 100644
>> --- a/package/libs/elfutils/patches/100-musl-compat.patch
>> +++ b/package/libs/elfutils/patches/100-musl-compat.patch
>> @@ -22,20 +22,9 @@ https://sourceware.org/bugzilla/show_bug.cgi?id=21002
>>   #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)
>> @@ -44,12 +33,15 @@ https://sourceware.org/bugzilla/show_bug.cgi?id=21002
>>   }
>>  --- 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);
>
>
> According to GNU documentation, this call uses insufficient buffer size (buflen is 0), so it should lead to error ERANGE. Moreover, supplying fixed string as a buffer does not look correct, so I doubt this does anything useful.
All I know is, this code is writteb with glibc in mind.
>
> Regards,
> Oldrich.
>
Oldřich Jedlička April 6, 2020, 2:45 p.m. UTC | #3
po 6. 4. 2020 v 8:45 odesílatel Rosen Penev <rosenp@gmail.com> napsal:

> On Sun, Apr 5, 2020 at 11:01 PM Oldřich Jedlička <oldium.pro@gmail.com>
> wrote:
> >
> > po 6. 4. 2020 v 4:02 odesílatel Rosen Penev <rosenp@gmail.com> napsal:
> >>
> >> 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>
> >> ---
> >>  package/libs/elfutils/Makefile                |  7 +-
> >>  .../patches/003-libintl-compatibility.patch   | 75 +++++++++----------
> >>  .../patches/005-build_only_libs.patch         | 13 ++--
> >>  .../elfutils/patches/100-musl-compat.patch    | 22 ++----
> >>  .../libs/elfutils/patches/101-no-fts.patch    |  2 +-
> >>  .../libs/elfutils/patches/110-no-cdefs.patch  | 58 ++++++++++++++
> >>  6 files changed, 113 insertions(+), 64 deletions(-)
> >>  create mode 100644 package/libs/elfutils/patches/110-no-cdefs.patch
> >>
> >> diff --git a/package/libs/elfutils/Makefile
> b/package/libs/elfutils/Makefile
> >> index 630c48820a..e6868c56f4 100644
> >> --- a/package/libs/elfutils/Makefile
> >> +++ b/package/libs/elfutils/Makefile
> >> @@ -7,12 +7,12 @@
> >>  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
> >> @@ -63,6 +63,7 @@ endif
> >>
> >>  CONFIGURE_ARGS += \
> >>         --program-prefix=eu- \
> >> +       --disable-debuginfod \
> >>         --without-lzma
> >>
> >>  TARGET_CFLAGS += -D_GNU_SOURCE -Wno-unused-result
> -Wno-format-nonliteral
> >> diff --git
> a/package/libs/elfutils/patches/003-libintl-compatibility.patch
> b/package/libs/elfutils/patches/003-libintl-compatibility.patch
> >> index 32bfaf8e6d..ea0f4535a5 100644
> >> --- a/package/libs/elfutils/patches/003-libintl-compatibility.patch
> >> +++ b/package/libs/elfutils/patches/003-libintl-compatibility.patch
> >> @@ -1,8 +1,31 @@
> >> ---- 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 read and write
> ELF files
> >> + 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/libdw.pc
> config/libdebuginfod.pc])
> >> + 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 _
> >> @@ -12,20 +35,19 @@
> >>
> >>  --- 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;
> >>
> >> @@ -35,11 +57,11 @@
> >>   /* 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 _
> >> @@ -47,26 +69,3 @@
> >>   /* 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>])
> >> diff --git a/package/libs/elfutils/patches/005-build_only_libs.patch
> b/package/libs/elfutils/patches/005-build_only_libs.patch
> >> index 93d593a0fc..a81d1d2cab 100644
> >> --- a/package/libs/elfutils/patches/005-build_only_libs.patch
> >> +++ b/package/libs/elfutils/patches/005-build_only_libs.patch
> >> @@ -1,12 +1,11 @@
> >>  --- 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
> >> diff --git a/package/libs/elfutils/patches/100-musl-compat.patch
> b/package/libs/elfutils/patches/100-musl-compat.patch
> >> index 109b7ece08..374e832d3f 100644
> >> --- a/package/libs/elfutils/patches/100-musl-compat.patch
> >> +++ b/package/libs/elfutils/patches/100-musl-compat.patch
> >> @@ -22,20 +22,9 @@
> https://sourceware.org/bugzilla/show_bug.cgi?id=21002
> >>   #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)
> >> @@ -44,12 +33,15 @@
> https://sourceware.org/bugzilla/show_bug.cgi?id=21002
> >>   }
> >>  --- 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);
> >
> >
> > According to GNU documentation, this call uses insufficient buffer size
> (buflen is 0), so it should lead to error ERANGE. Moreover, supplying fixed
> string as a buffer does not look correct, so I doubt this does anything
> useful.
> All I know is, this code is writteb with glibc in mind.
>

I checked glibc sources and it either returns address of glibc error
message (from a static table), or tries to fill the buffer with “Unknown
error N” if there is enough space (in this case it just returns pointer to
the “bad” string without modifying it). So fine for me.


> >
> > Regards,
> > Oldrich.
> >
>
diff mbox series

Patch

diff --git a/package/libs/elfutils/Makefile b/package/libs/elfutils/Makefile
index 630c48820a..e6868c56f4 100644
--- a/package/libs/elfutils/Makefile
+++ b/package/libs/elfutils/Makefile
@@ -7,12 +7,12 @@ 
 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
@@ -63,6 +63,7 @@  endif
 
 CONFIGURE_ARGS += \
 	--program-prefix=eu- \
+	--disable-debuginfod \
 	--without-lzma
 
 TARGET_CFLAGS += -D_GNU_SOURCE -Wno-unused-result -Wno-format-nonliteral
diff --git a/package/libs/elfutils/patches/003-libintl-compatibility.patch b/package/libs/elfutils/patches/003-libintl-compatibility.patch
index 32bfaf8e6d..ea0f4535a5 100644
--- a/package/libs/elfutils/patches/003-libintl-compatibility.patch
+++ b/package/libs/elfutils/patches/003-libintl-compatibility.patch
@@ -1,8 +1,31 @@ 
---- 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 read and write ELF files
+ 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/libdw.pc config/libdebuginfod.pc])
+ 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 _
@@ -12,20 +35,19 @@ 
  
 --- 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;
  
@@ -35,11 +57,11 @@ 
  /* 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 _
@@ -47,26 +69,3 @@ 
  /* 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>])
diff --git a/package/libs/elfutils/patches/005-build_only_libs.patch b/package/libs/elfutils/patches/005-build_only_libs.patch
index 93d593a0fc..a81d1d2cab 100644
--- a/package/libs/elfutils/patches/005-build_only_libs.patch
+++ b/package/libs/elfutils/patches/005-build_only_libs.patch
@@ -1,12 +1,11 @@ 
 --- 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
diff --git a/package/libs/elfutils/patches/100-musl-compat.patch b/package/libs/elfutils/patches/100-musl-compat.patch
index 109b7ece08..374e832d3f 100644
--- a/package/libs/elfutils/patches/100-musl-compat.patch
+++ b/package/libs/elfutils/patches/100-musl-compat.patch
@@ -22,20 +22,9 @@  https://sourceware.org/bugzilla/show_bug.cgi?id=21002
  #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)
@@ -44,12 +33,15 @@  https://sourceware.org/bugzilla/show_bug.cgi?id=21002
  }
 --- 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):
diff --git a/package/libs/elfutils/patches/101-no-fts.patch b/package/libs/elfutils/patches/101-no-fts.patch
index a6e192f8ff..29ec9ecac0 100644
--- a/package/libs/elfutils/patches/101-no-fts.patch
+++ b/package/libs/elfutils/patches/101-no-fts.patch
@@ -72,7 +72,7 @@ 
  	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 \
diff --git a/package/libs/elfutils/patches/110-no-cdefs.patch b/package/libs/elfutils/patches/110-no-cdefs.patch
new file mode 100644
index 0000000000..b5f8b08127
--- /dev/null
+++ b/package/libs/elfutils/patches/110-no-cdefs.patch
@@ -0,0 +1,58 @@ 
+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(-)
+
+diff --git a/lib/fixedsizehash.h b/lib/fixedsizehash.h
+index dac2a5f5..43016fc3 100644
+--- 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>
+ 
+diff --git a/libelf/elf.h b/libelf/elf.h
+index 01648bdb..d36fb806 100644
+--- 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 */
+-- 
+2.25.1
+