elfutils: update to 0.182, add debuginfod subpkgs, adopt.

Cleaned up patches, remove the aarch64-fregs one (it was fixed with a
musl patch, instead), and moved closer to where upstream is moving
regarding musl compat.
This commit is contained in:
Érico Rolim 2020-10-25 18:57:17 -03:00 committed by Érico Nogueira Rolim
parent 2064539bfc
commit cc255456b1
12 changed files with 218 additions and 224 deletions

View File

@ -737,6 +737,7 @@ libmtp.so.9 libmtp-1.1.4_1
libelf.so.1 libelf-0.155_1
libdw.so.1 libelf-0.155_1
libasm.so.1 libelf-0.155_1
libdebuginfod.so.1 libdebuginfod-0.182_1
libgtksourceview-3.0.so.1 gtksourceview-3.8.0_1
libtalloc.so.2 talloc-2.0.1_1
libmount.so.1 libmount-2.18_1

1
srcpkgs/debuginfod Symbolic link
View File

@ -0,0 +1 @@
elfutils

View File

@ -0,0 +1,13 @@
diff --git debuginfod/debuginfod.cxx debuginfod/debuginfod.cxx
index 3085f388..d2a434ee 100644
--- debuginfod/debuginfod.cxx
+++ debuginfod/debuginfod.cxx
@@ -46,7 +46,7 @@ extern "C" {
#include <unistd.h>
#include <stdlib.h>
#include <error.h>
-// #include <libintl.h> // not until it supports C++ << better
+#include <libintl.h>
#include <locale.h>
#include <pthread.h>
#include <signal.h>

View File

@ -1,14 +0,0 @@
It looks like fregs.vregs[] is an array of double?
Casting to Dwarf_Word instead of & 0xFFFFFFF should do.
--- backends/aarch64_initreg.c 2015-11-27 14:36:29.000000000 +0100
+++ backends/aarch64_initreg.c 2016-08-09 03:47:25.428560159 +0200
@@ -82,7 +83,7 @@
Dwarf_Word dwarf_fregs[32];
for (int r = 0; r < 32; r++)
- dwarf_fregs[r] = fregs.vregs[r] & 0xFFFFFFFF;
+ dwarf_fregs[r] = (Dwarf_Word)fregs.vregs[r];
if (! setfunc (64, 32, dwarf_fregs, arg))
return false;

View File

@ -1,11 +0,0 @@
--- libcpu/i386_disasm.c 2015-08-21 14:22:37.000000000 +0200
+++ libcpu/i386_disasm.c 2015-11-20 06:30:59.250629957 +0100
@@ -710,6 +710,7 @@
case 'm':
/* Mnemonic. */
+ str = mnebuf;
if (unlikely (instrtab[cnt].mnemonic == MNE_INVALID))
{

View File

@ -0,0 +1,107 @@
diff --git ChangeLog ChangeLog
index 128da6c6..565d021c 100644
--- ChangeLog
+++ ChangeLog
@@ -1,3 +1,7 @@
+2020-11-01 Érico N. Rolim <erico.erc@gmail.com>
+
+ * configure.ac: Check for fts and obstack from outside libc.
+
2020-10-28 Mark Wielaard <mark@klomp.org>
* configure.ac: Set version to 0.182.
diff --git configure.ac configure.ac
index 515ac704..c1a6954d 100644
--- configure.ac
+++ configure.ac
@@ -542,6 +542,26 @@ else
fi
AC_SUBST([argp_LDADD])
+saved_LIBS="$LIBS"
+AC_SEARCH_LIBS([fts_close], [fts])
+LIBS="$saved_LIBS"
+case "$ac_cv_search_fts_close" in
+ no) AC_MSG_FAILURE([failed to find fts_close]) ;;
+ -l*) fts_LIBS="$ac_cv_search_fts_close" ;;
+ *) fts_LIBS= ;;
+esac
+AC_SUBST([fts_LIBS])
+
+saved_LIBS="$LIBS"
+AC_SEARCH_LIBS([_obstack_free], [obstack])
+LIBS="$saved_LIBS"
+case "$ac_cv_search__obstack_free" in
+ no) AC_MSG_FAILURE([failed to find obstack_free]) ;;
+ -l*) obstack_LIBS="$ac_cv_search__obstack_free" ;;
+ *) obstack_LIBS= ;;
+esac
+AC_SUBST([obstack_LIBS])
+
dnl The directories with content.
dnl Documentation.
diff --git debuginfod/Makefile.am debuginfod/Makefile.am
index 01985600..0af3b58c 100644
--- debuginfod/Makefile.am
+++ debuginfod/Makefile.am
@@ -71,10 +71,10 @@ bin_PROGRAMS += debuginfod-find
endif
debuginfod_SOURCES = debuginfod.cxx
-debuginfod_LDADD = $(libdw) $(libelf) $(libeu) $(libdebuginfod) $(libmicrohttpd_LIBS) $(sqlite3_LIBS) $(libarchive_LIBS) -lpthread -ldl
+debuginfod_LDADD = $(libdw) $(libelf) $(libeu) $(libdebuginfod) $(argp_LDADD) $(fts_LIBS) $(libmicrohttpd_LIBS) $(sqlite3_LIBS) $(libarchive_LIBS) -lpthread -ldl
debuginfod_find_SOURCES = debuginfod-find.c
-debuginfod_find_LDADD = $(libdw) $(libelf) $(libeu) $(libdebuginfod)
+debuginfod_find_LDADD = $(libdw) $(libelf) $(libeu) $(libdebuginfod) $(argp_LDADD) $(fts_LIBS)
if LIBDEBUGINFOD
noinst_LIBRARIES = libdebuginfod.a
@@ -98,7 +98,7 @@ libdebuginfod_so_LIBS = libdebuginfod_pic.a
if DUMMY_LIBDEBUGINFOD
libdebuginfod_so_LDLIBS =
else
-libdebuginfod_so_LDLIBS = $(libcurl_LIBS)
+libdebuginfod_so_LDLIBS = $(libcurl_LIBS) $(fts_LIBS)
endif
libdebuginfod.so$(EXEEXT): $(srcdir)/libdebuginfod.map $(libdebuginfod_so_LIBS)
$(AM_V_CCLD)$(LINK) $(dso_LDFLAGS) -o $@ \
diff --git libdw/Makefile.am libdw/Makefile.am
index 33b5838d..1dbb3d5e 100644
--- libdw/Makefile.am
+++ libdw/Makefile.am
@@ -109,7 +109,7 @@ libdw_so_LIBS = ../libebl/libebl_pic.a ../backends/libebl_backends_pic.a \
../libcpu/libcpu_pic.a libdw_pic.a ../libdwelf/libdwelf_pic.a \
../libdwfl/libdwfl_pic.a
libdw_so_DEPS = ../lib/libeu.a ../libelf/libelf.so
-libdw_so_LDLIBS = $(libdw_so_DEPS) -ldl -lz $(argp_LDADD) $(zip_LIBS) -pthread
+libdw_so_LDLIBS = $(libdw_so_DEPS) -ldl -lz $(argp_LDADD) $(fts_LIBS) $(obstack_LIBS) $(zip_LIBS) -pthread
libdw_so_SOURCES =
libdw.so$(EXEEXT): $(srcdir)/libdw.map $(libdw_so_LIBS) $(libdw_so_DEPS)
$(AM_V_CCLD)$(LINK) $(dso_LDFLAGS) -o $@ \
diff --git src/Makefile.am src/Makefile.am
index e462e7d7..88d0ac8f 100644
--- src/Makefile.am
+++ src/Makefile.am
@@ -69,7 +69,7 @@ ar_no_Wstack_usage = yes
unstrip_no_Wstack_usage = yes
readelf_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(argp_LDADD)
-nm_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(argp_LDADD) \
+nm_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(argp_LDADD) $(obstack_LIBS) \
$(demanglelib)
size_LDADD = $(libelf) $(libeu) $(argp_LDADD)
strip_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD)
@@ -78,9 +78,9 @@ findtextrel_LDADD = $(libdw) $(libelf) $(libeu) $(argp_LDADD)
addr2line_LDADD = $(libdw) $(libelf) $(libeu) $(argp_LDADD) $(demanglelib)
elfcmp_LDADD = $(libebl) $(libdw) $(libelf) $(libeu) $(argp_LDADD)
objdump_LDADD = $(libasm) $(libebl) $(libdw) $(libelf) $(libeu) $(argp_LDADD)
-ranlib_LDADD = libar.a $(libelf) $(libeu) $(argp_LDADD)
+ranlib_LDADD = libar.a $(libelf) $(libeu) $(argp_LDADD) $(obstack_LIBS)
strings_LDADD = $(libelf) $(libeu) $(argp_LDADD)
-ar_LDADD = libar.a $(libelf) $(libeu) $(argp_LDADD)
+ar_LDADD = libar.a $(libelf) $(libeu) $(argp_LDADD) $(obstack_LIBS)
unstrip_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD)
stack_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD) $(demanglelib)
elfcompress_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD)

View File

@ -1,30 +0,0 @@
--- libelf/elf.h 2015-08-21 14:22:37.000000000 +0200
+++ libelf/elf.h 2015-11-20 04:54:33.948081321 +0100
@@ -21,6 +21,17 @@
#include <features.h>
+#if !defined(__BEGIN_DECLS)
+/* C++ needs to know that types and declarations are C, not C++. */
+#ifdef __cplusplus
+# define __BEGIN_DECLS extern "C" {
+# define __END_DECLS }
+#else
+# define __BEGIN_DECLS
+# define __END_DECLS
+#endif
+#endif
+
__BEGIN_DECLS
/* Standard ELF types. */
--- lib/fixedsizehash.h.orig
+++ lib/fixedsizehash.h
@@ -30,7 +30,6 @@
#include <errno.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/cdefs.h>
#include <system.h>

View File

@ -1,87 +0,0 @@
--- configure.ac 2015-10-15 15:16:57.000000000 +0200
+++ configure.ac 2015-11-20 05:32:57.723901582 +0100
@@ -305,6 +305,62 @@
fi
AC_SUBST([argp_LDADD])
+dnl Check if we have fts available from our libc
+AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [#if !defined(__x86_64__)
+ #undef _FILE_OFFSET_BITS
+ #define _FILE_OFFSET_BITS 32
+ #endif
+ #include <fts.h>],
+ [FTS* fts = 0; return fts_close(fts); return 0;]
+ )],
+ [libc_has_fts="true"],
+ [libc_has_fts="false"]
+)
+
+dnl If our libc doesn't provide fts, then test for libfts
+if test "$libc_has_fts" = "false" ; then
+ AC_MSG_WARN("libc does not have fts")
+ AC_CHECK_LIB([fts], [fts_close], [have_fts="true"], [have_fts="false"])
+
+ if test "$have_fts" = "false"; then
+ AC_MSG_ERROR("no libfts found")
+ else
+ fts_LDADD="-lfts"
+ fi
+else
+ fts_LDADD=""
+fi
+AC_SUBST([fts_LDADD])
+
+dnl Check if we have obstack available from our libc
+AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [#include <obstack.h>],
+ [_obstack_begin(0, 0, 0, NULL, NULL); return 0;]
+ )],
+ [libc_has_obstack="true"],
+ [libc_has_obstack="false"]
+)
+
+dnl If our libc doesn't provide obstack, then test for libobstack
+if test "$libc_has_obstack" = "false" ; then
+ AC_MSG_WARN("libc does not have obstack")
+ AC_CHECK_LIB([obstack], [_obstack_begin], [have_obstack="true"], [have_obstack="false"])
+
+ if test "$have_obstack" = "false"; then
+ AC_MSG_ERROR("no libobstack found")
+ else
+ obstack_LDADD="-lobstack"
+ fi
+else
+ obstack_LDADD=""
+fi
+AC_SUBST([obstack_LDADD])
+
+dnl The directories with content.
+
dnl The directories with content.
dnl Documentation.
--- src/Makefile.am.orig
+++ src/Makefile.am
@@ -46,7 +46,7 @@
else
libasm = ../libasm/libasm.so
libdw = ../libdw/libdw.so
-libelf = ../libelf/libelf.so
+libelf = ../libelf/libelf.so $(fts_LDADD) $(obstack_LDADD)
endif
libebl = ../libebl/libebl.a
libeu = ../lib/libeu.a
--- libdw/Makefile.am.orig
+++ libdw/Makefile.am
@@ -109,7 +109,7 @@
../libcpu/libcpu_pic.a libdw_pic.a ../libdwelf/libdwelf_pic.a \
../libdwfl/libdwfl_pic.a
libdw_so_DEPS = ../lib/libeu.a ../libelf/libelf.so
-libdw_so_LDLIBS = $(libdw_so_DEPS) -ldl -lz $(argp_LDADD) $(zip_LIBS) -pthread
+libdw_so_LDLIBS = $(libdw_so_DEPS) -ldl -lz $(argp_LDADD) $(fts_LDADD) $(obstack_LDADD) $(zip_LIBS) -pthread
libdw_so_SOURCES =
libdw.so$(EXEEXT): $(srcdir)/libdw.map $(libdw_so_LIBS) $(libdw_so_DEPS)
$(AM_V_CCLD)$(LINK) $(dso_LDFLAGS) -o $@ \

View File

@ -1,66 +1,74 @@
--- src/arlib.h 2015-08-21 14:22:37.000000000 +0200
+++ src/arlib.h 2015-11-20 08:02:55.153199611 +0100
@@ -29,6 +29,16 @@
#include <stdint.h>
#include <sys/types.h>
diff --git debuginfod/debuginfod-client.c debuginfod/debuginfod-client.c
index 0e5177bc..ce1d819b 100644
--- debuginfod/debuginfod-client.c
+++ debuginfod/debuginfod-client.c
@@ -212,13 +212,13 @@ debuginfod_init_cache (char *cache_path, char *interval_path, char *maxage_path)
return 0;
+#if !defined(ACCESSPERMS)
+# define ACCESSPERMS (S_IRWXU|S_IRWXG|S_IRWXO) /* 0777 */
+#endif
+#if !defined(ALLPERMS)
+# define ALLPERMS (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO) /* 07777 */
+#endif
+#if !defined(DEFFILEMODE)
+# define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)/* 0666*/
/* Create the cache and config files as necessary. */
- if (stat(cache_path, &st) != 0 && mkdir(cache_path, 0777) < 0)
+ if (stat(cache_path, &st) != 0 && mkdir(cache_path, ACCESSPERMS) < 0)
return -errno;
int fd = -1;
/* init cleaning interval config file. */
- fd = open(interval_path, O_CREAT | O_RDWR, 0666);
+ fd = open(interval_path, O_CREAT | O_RDWR, DEFFILEMODE);
if (fd < 0)
return -errno;
@@ -227,7 +227,7 @@ debuginfod_init_cache (char *cache_path, char *interval_path, char *maxage_path)
/* init max age config file. */
if (stat(maxage_path, &st) != 0
- && (fd = open(maxage_path, O_CREAT | O_RDWR, 0666)) < 0)
+ && (fd = open(maxage_path, O_CREAT | O_RDWR, DEFFILEMODE)) < 0)
return -errno;
if (dprintf(fd, "%ld", cache_default_max_unused_age_s) < 0)
diff --git lib/system.h lib/system.h
index 292082bd..5d16ebc6 100644
--- lib/system.h
+++ lib/system.h
@@ -85,6 +85,18 @@
__res; })
#endif
+#ifndef ACCESSPERMS
+#define ACCESSPERMS (S_IRWXU|S_IRWXG|S_IRWXO) /* 0777 */
+#endif
+
/* State of -D/-U flags. */
extern bool arlib_deterministic_output;
--- src/elfcompress.c.orig 2016-04-02 12:51:26.903848894 +0200
+++ src/elfcompress.c 2016-04-02 12:55:15.076996338 +0200
@@ -35,6 +35,14 @@
#include <gelf.h>
#include "system.h"
+#if !defined(FNM_EXTMATCH)
+# define FNM_EXTMATCH 0
+#ifndef ALLPERMS
+#define ALLPERMS (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO) /* 07777 */
+#endif
+
+#if !defined(ALLPERMS)
+# define ALLPERMS (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO) /* 07777 */
+#ifndef DEFFILEMODE
+#define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)/* DEFFILEMODE*/
+#endif
+
/* Name and version of program. */
static void print_version (FILE *stream, struct argp_state *state);
ARGP_PROGRAM_VERSION_HOOK_DEF = print_version;
--- src/strip.c.orig 2017-08-02 12:06:25.000000000 +0000
+++ src/strip.c 2017-08-05 01:58:01.523493062 +0000
@@ -47,6 +47,14 @@
#include <system.h>
#include <printversion.h>
static inline ssize_t __attribute__ ((unused))
pwrite_retry (int fd, const void *buf, size_t len, off_t off)
{
diff --git src/unstrip.c src/unstrip.c
index 0257d9cc..c99ee612 100644
--- src/unstrip.c
+++ src/unstrip.c
@@ -315,7 +315,7 @@ make_directories (const char *path)
if (dir == NULL)
error(EXIT_FAILURE, errno, _("memory exhausted"));
+#if !defined(FNM_EXTMATCH)
+# define FNM_EXTMATCH 0
+#endif
+
+#if !defined(ACCESSPERMS)
+#define ACCESSPERMS (S_IRWXU|S_IRWXG|S_IRWXO)
+#endif
+
typedef uint8_t GElf_Byte;
- while (mkdir (dir, 0777) < 0 && errno != EEXIST)
+ while (mkdir (dir, ACCESSPERMS) < 0 && errno != EEXIST)
{
if (errno == ENOENT)
make_directories (dir);
@@ -2192,7 +2192,7 @@ DWARF data in '%s' not adjusted for prelinking bias; consider prelink -u"),
/* Name and version of program. */
--- tests/elfstrmerge.c.orig 2020-09-13 08:20:50.538492600 +0700
+++ tests/elfstrmerge.c 2020-09-13 08:21:40.205734827 +0700
@@ -33,6 +33,10 @@
#include ELFUTILS_HEADER(dwelf)
#include "elf-knowledge.h"
+#if !defined(ALLPERMS)
+# define ALLPERMS (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO) /* 07777 */
+#endif
+
/* The original ELF file. */
static int fd = -1;
static Elf *elf = NULL;
/* Copy the unstripped file and then modify it. */
int outfd = open (output_file, O_RDWR | O_CREAT,
- stripped_ehdr->e_type == ET_REL ? 0666 : 0777);
+ stripped_ehdr->e_type == ET_REL ? DEFFILEMODE : ACCESSPERMS);
if (outfd < 0)
error (EXIT_FAILURE, errno, _("cannot open '%s'"), output_file);
Elf *outelf = elf_begin (outfd, ELF_C_WRITE, NULL);

View File

@ -1,18 +0,0 @@
--- src/unstrip.c.orig 2017-04-27 14:26:26.000000000 +0000
+++ src/unstrip.c 2017-05-05 15:51:33.515154220 +0000
@@ -56,6 +56,15 @@
# define _(str) gettext (str)
#endif
+#ifndef strndupa
+#define strndupa(s, n) \
+ (__extension__ ({const char *__in = (s); \
+ size_t __len = strnlen (__in, (n)) + 1; \
+ char *__out = (char *) alloca (__len); \
+ __out[__len-1] = '\0'; \
+ (char *) memcpy (__out, __in, __len-1);}))
+#endif
+
/* Name and version of program. */
ARGP_PROGRAM_VERSION_HOOK_DEF = print_version;

View File

@ -1,22 +1,26 @@
# Template file for 'elfutils'
pkgname=elfutils
version=0.181
version=0.182
revision=1
build_style=gnu-configure
configure_args="--program-prefix=eu- --disable-debuginfod --disable-libdebuginfod"
configure_args="--program-prefix=eu-"
hostmakedepends="automake libtool pkg-config"
makedepends="bzip2-devel liblzma-devel zlib-devel"
makedepends="bzip2-devel liblzma-devel zlib-devel
libcurl-devel libarchive-devel sqlite-devel libmicrohttpd-devel"
short_desc="Utilities to handle ELF object files"
maintainer="Orphaned <orphan@voidlinux.org>"
maintainer="Érico Nogueira <ericonr@disroot.org>"
license="GPL-3.0-or-later"
homepage="https://sourceware.org/elfutils/"
distfiles="https://sourceware.org/${pkgname}/ftp/${version}/${pkgname}-${version}.tar.bz2"
checksum=29a6ad7421ec2acfee489bb4a699908281ead2cb63a20a027ce8804a165f0eb3
checksum=ecc406914edf335f0b7fc084ebe6c460c4d6d5175bfdd6688c1c78d9146b8858
CFLAGS="-Wno-error"
CXXFLAGS="-Wl,-z,stack-size=2097152"
if [ "$XBPS_TARGET_LIBC" = musl ]; then
makedepends+=" argp-standalone musl-fts-devel musl-obstack-devel"
makedepends+=" argp-standalone musl-fts-devel musl-obstack-devel musl-legacy-compat"
# XXX: breaks some expected functionality
CFLAGS+=" -DFNM_EXTMATCH=0"
fi
post_extract() {
@ -30,6 +34,23 @@ pre_configure() {
autoreconf -if
}
libdebuginfod_package() {
short_desc+=" - debuginfod library"
pkg_install() {
vmove "usr/lib/libdebuginfod-*.so*"
vmove etc/profile.d
}
}
debuginfod_package() {
short_desc+=" - debuginfod programs"
pkg_install() {
vmove "usr/bin/debuginfod*"
vmove "usr/share/man/man1/debuginfod-find.1"
vmove "usr/share/man/man8/debuginfod.8"
}
}
libelf_package() {
short_desc+=" - runtime library"
pkg_install() {
@ -38,11 +59,13 @@ libelf_package() {
}
elfutils-devel_package() {
depends="libelf>=${version}_${revision} ${makedepends}"
depends="libelf>=${version}_${revision} libdebuginfod>=${version}_${revision}
${makedepends}"
short_desc+=" - development files"
pkg_install() {
vmove usr/include
vmove usr/lib/pkgconfig
vmove "usr/lib/*.a"
vmove usr/share/man/man3
}
}

1
srcpkgs/libdebuginfod Symbolic link
View File

@ -0,0 +1 @@
elfutils