From bb96ab725f7b8871c90e8129f50c409768a98f6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89rico=20Rolim?= Date: Mon, 8 Feb 2021 19:47:17 -0300 Subject: [PATCH 1/2] musl-legacy-compat: add fflush call to error(). The testsuite for elfutils expects things printed to stdout before calling error() to appear before the error message; glibc implements this by calling fflush(stdout) after checking the stream is still valid. Here, we will simply flush all output streams. --- srcpkgs/musl-legacy-compat/files/error.h | 4 ++++ srcpkgs/musl-legacy-compat/template | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/srcpkgs/musl-legacy-compat/files/error.h b/srcpkgs/musl-legacy-compat/files/error.h index 4505784182a..835d0cb7f7d 100644 --- a/srcpkgs/musl-legacy-compat/files/error.h +++ b/srcpkgs/musl-legacy-compat/files/error.h @@ -13,6 +13,10 @@ static unsigned int error_message_count = 0; static inline void error(int status, int errnum, const char* format, ...) { + /* should be fflush(stdout), but that's unspecified if stdout has been closed; + * stick with fflush(NULL) for simplicity (glibc checks if the fd is still valid) */ + fflush(NULL); + va_list ap; fprintf(stderr, "%s: ", program_invocation_name); va_start(ap, format); diff --git a/srcpkgs/musl-legacy-compat/template b/srcpkgs/musl-legacy-compat/template index afc447314f4..a59d4e7683f 100644 --- a/srcpkgs/musl-legacy-compat/template +++ b/srcpkgs/musl-legacy-compat/template @@ -1,7 +1,7 @@ # Template file for 'musl-legacy-compat' pkgname=musl-legacy-compat version=0.4 -revision=1 +revision=2 archs="*-musl" bootstrap=yes short_desc="Legacy compatibility headers for the musl libc" From 10661a80a204f065d6b8db1109a7ca2cdfa6677f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89rico=20Rolim?= Date: Wed, 16 Dec 2020 17:47:44 -0300 Subject: [PATCH 2/2] elfutils: update to 0.183. Remove all patches: they are now all upstream :) Also add more checkdepends so we skip less tests. --- srcpkgs/elfutils/patches/debuginfod.patch | 13 --- srcpkgs/elfutils/patches/fts-obstack.patch | 107 ------------------ .../elfutils/patches/musl-asm_ptrace_h.patch | 10 -- srcpkgs/elfutils/patches/musl-macros.patch | 74 ------------ srcpkgs/elfutils/patches/musl-qsort_r.patch | 65 ----------- .../elfutils/patches/musl-strerror_r.patch | 19 ---- srcpkgs/elfutils/template | 14 +-- 7 files changed, 6 insertions(+), 296 deletions(-) delete mode 100644 srcpkgs/elfutils/patches/debuginfod.patch delete mode 100644 srcpkgs/elfutils/patches/fts-obstack.patch delete mode 100644 srcpkgs/elfutils/patches/musl-asm_ptrace_h.patch delete mode 100644 srcpkgs/elfutils/patches/musl-macros.patch delete mode 100644 srcpkgs/elfutils/patches/musl-qsort_r.patch delete mode 100644 srcpkgs/elfutils/patches/musl-strerror_r.patch diff --git a/srcpkgs/elfutils/patches/debuginfod.patch b/srcpkgs/elfutils/patches/debuginfod.patch deleted file mode 100644 index d26d945d1ff..00000000000 --- a/srcpkgs/elfutils/patches/debuginfod.patch +++ /dev/null @@ -1,13 +0,0 @@ -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 - #include - #include --// #include // not until it supports C++ << better -+#include - #include - #include - #include diff --git a/srcpkgs/elfutils/patches/fts-obstack.patch b/srcpkgs/elfutils/patches/fts-obstack.patch deleted file mode 100644 index 44ef0aee70e..00000000000 --- a/srcpkgs/elfutils/patches/fts-obstack.patch +++ /dev/null @@ -1,107 +0,0 @@ -diff --git ChangeLog ChangeLog -index 128da6c6..565d021c 100644 ---- ChangeLog -+++ ChangeLog -@@ -1,3 +1,7 @@ -+2020-11-01 Érico N. Rolim -+ -+ * configure.ac: Check for fts and obstack from outside libc. -+ - 2020-10-28 Mark Wielaard - - * 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) diff --git a/srcpkgs/elfutils/patches/musl-asm_ptrace_h.patch b/srcpkgs/elfutils/patches/musl-asm_ptrace_h.patch deleted file mode 100644 index d4ebf315549..00000000000 --- a/srcpkgs/elfutils/patches/musl-asm_ptrace_h.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- backends/ppc_initreg.c 2019-11-26 23:48:42.000000000 +0100 -+++ backends/ppc_initreg.c 2019-12-08 16:57:58.334872602 +0100 -@@ -32,6 +32,7 @@ - - #include - #if defined(__powerpc__) && defined(__linux__) -+# include - # include - # include - #endif diff --git a/srcpkgs/elfutils/patches/musl-macros.patch b/srcpkgs/elfutils/patches/musl-macros.patch deleted file mode 100644 index 97a8c2bf352..00000000000 --- a/srcpkgs/elfutils/patches/musl-macros.patch +++ /dev/null @@ -1,74 +0,0 @@ -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; - - /* 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 -+ -+#ifndef ALLPERMS -+#define ALLPERMS (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO) /* 07777 */ -+#endif -+ -+#ifndef DEFFILEMODE -+#define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)/* DEFFILEMODE*/ -+#endif -+ - 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")); - -- 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"), - - /* 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); diff --git a/srcpkgs/elfutils/patches/musl-qsort_r.patch b/srcpkgs/elfutils/patches/musl-qsort_r.patch deleted file mode 100644 index 10697d6023a..00000000000 --- a/srcpkgs/elfutils/patches/musl-qsort_r.patch +++ /dev/null @@ -1,65 +0,0 @@ ---- src/readelf.c -+++ src/readelf.c -@@ -4773,10 +4773,11 @@ listptr_base (struct listptr *p) - return cudie_base (&cu); - } - -+static const char *listptr_name; -+ - static int --compare_listptr (const void *a, const void *b, void *arg) -+compare_listptr (const void *a, const void *b) - { -- const char *name = arg; - struct listptr *p1 = (void *) a; - struct listptr *p2 = (void *) b; - -@@ -4792,21 +4793,21 @@ compare_listptr (const void *a, const void *b, void *arg) - p1->warned = p2->warned = true; - error (0, 0, - gettext ("%s %#" PRIx64 " used with different address sizes"), -- name, (uint64_t) p1->offset); -+ listptr_name, (uint64_t) p1->offset); - } - if (p1->dwarf64 != p2->dwarf64) - { - p1->warned = p2->warned = true; - error (0, 0, - gettext ("%s %#" PRIx64 " used with different offset sizes"), -- name, (uint64_t) p1->offset); -+ listptr_name, (uint64_t) p1->offset); - } - if (listptr_base (p1) != listptr_base (p2)) - { - p1->warned = p2->warned = true; - error (0, 0, - gettext ("%s %#" PRIx64 " used with different base addresses"), -- name, (uint64_t) p1->offset); -+ listptr_name, (uint64_t) p1->offset); - } - if (p1->attr != p2 ->attr) - { -@@ -4814,7 +4815,7 @@ compare_listptr (const void *a, const void *b, void *arg) - error (0, 0, - gettext ("%s %#" PRIx64 - " used with different attribute %s and %s"), -- name, (uint64_t) p1->offset, dwarf_attr_name (p2->attr), -+ listptr_name, (uint64_t) p1->offset, dwarf_attr_name (p2->attr), - dwarf_attr_name (p2->attr)); - } - } -@@ -4885,9 +4886,11 @@ notice_listptr (enum section_e section, struct listptr_table *table, - static void - sort_listptr (struct listptr_table *table, const char *name) - { -- if (table->n > 0) -- qsort_r (table->table, table->n, sizeof table->table[0], -- &compare_listptr, (void *) name); -+ if (table->n > 0) { -+ listptr_name = name; -+ qsort (table->table, table->n, sizeof table->table[0], -+ &compare_listptr); -+ } - } - - static bool diff --git a/srcpkgs/elfutils/patches/musl-strerror_r.patch b/srcpkgs/elfutils/patches/musl-strerror_r.patch deleted file mode 100644 index d7797e9214a..00000000000 --- a/srcpkgs/elfutils/patches/musl-strerror_r.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- libdwfl/dwfl_error.c 2015-09-29 17:18:51.000000000 +0200 -+++ libdwfl/dwfl_error.c 2015-11-20 05:11:29.889002058 +0100 -@@ -154,7 +154,16 @@ - switch (error &~ 0xffff) - { - case OTHER_ERROR (ERRNO): -+#if defined(__GLIBC__) - return strerror_r (error & 0xffff, "bad", 0); -+#else -+ { -+ static __thread char buf[128] = ""; -+ if (0 == strerror_r(error & 0xffff, buf, sizeof(buf))) -+ return buf; -+ } -+ return "strerror_r() failed"; -+#endif - case OTHER_ERROR (LIBELF): - return elf_errmsg (error & 0xffff); - case OTHER_ERROR (LIBDW): diff --git a/srcpkgs/elfutils/template b/srcpkgs/elfutils/template index 2f4fb896ec9..eb6ccbbc7dc 100644 --- a/srcpkgs/elfutils/template +++ b/srcpkgs/elfutils/template @@ -1,22 +1,24 @@ # Template file for 'elfutils' pkgname=elfutils -version=0.182 -revision=4 +version=0.183 +revision=1 build_style=gnu-configure configure_args="--program-prefix=eu-" hostmakedepends="automake libtool pkg-config" _devel_depends="bzip2-devel liblzma-devel zlib-devel libzstd-devel" makedepends="${_devel_depends} libcurl-devel libarchive-devel sqlite-devel libmicrohttpd-devel" +checkdepends="zstd bzip2 curl rpm cpio" short_desc="Utilities to handle ELF object files" maintainer="Érico Nogueira " license="GPL-3.0-or-later" homepage="https://sourceware.org/elfutils/" distfiles="https://sourceware.org/${pkgname}/ftp/${version}/${pkgname}-${version}.tar.bz2" -checksum=ecc406914edf335f0b7fc084ebe6c460c4d6d5175bfdd6688c1c78d9146b8858 +checksum=c3637c208d309d58714a51e61e63f1958808fead882e9b607506a29e5474f2c5 # subpackages require explicit ordering subpackages="debuginfod libdebuginfod libelf elfutils-devel" +# mainly warnings from using error.h CFLAGS="-Wno-error" CXXFLAGS="-Wno-error -Wl,-z,stack-size=2097152" @@ -26,13 +28,9 @@ if [ "$XBPS_TARGET_LIBC" = musl ]; then CFLAGS+=" -DFNM_EXTMATCH=0" fi -pre_configure() { - autoreconf -if -} - do_check() { make check ${makejobs} || - msg_warn "Failure in testsuite, expected on musl systems, at least" + msg_warn "Failure in testsuite, expected on musl systems, at least\n" } libdebuginfod_package() {