Skip to Content.
Sympa Menu

sm-commit - [SM-Commit] GIT changes to master grimoire by Ismael Luceno (2fe2edb5219d58091261ff31a326a7ee32af372c)

sm-commit AT lists.ibiblio.org

Subject: Source Mage code commit list

List archive

Chronological Thread  
  • From: Ismael Luceno <scm AT sourcemage.org>
  • To: sm-commit AT lists.ibiblio.org
  • Subject: [SM-Commit] GIT changes to master grimoire by Ismael Luceno (2fe2edb5219d58091261ff31a326a7ee32af372c)
  • Date: Fri, 4 Sep 2020 19:45:59 +0000

GIT changes to master grimoire by Ismael Luceno <ismael AT sourcemage.org>:

libs/elfutils/BUILD | 7 ++-
libs/elfutils/DEPENDS | 7 +++
libs/elfutils/HISTORY | 8 +++
libs/elfutils/PRE_BUILD | 14 +++---
libs/elfutils/error.h | 27 ++++++++++++
libs/elfutils/patches/fix-uninitialized.patch | 18 ++++++++
libs/elfutils/patches/musl-asm_ptrace_h.patch | 12 +++++
libs/elfutils/patches/musl-cdefs.patch | 31 ++++++++++++++
libs/elfutils/patches/musl-macros.patch | 55
++++++++++++++++++++++++++
libs/elfutils/patches/musl-qsort_r.patch | 34 ++++++++++++++++
libs/elfutils/patches/musl-strerror_r.patch | 21 +++++++++
libs/elfutils/patches/musl-strndupa.patch | 20 +++++++++
12 files changed, 247 insertions(+), 7 deletions(-)

New commits:
commit 2fe2edb5219d58091261ff31a326a7ee32af372c
Author: Ismael Luceno <ismael AT sourcemage.org>
Commit: Ismael Luceno <ismael AT sourcemage.org>

elfutils 0.180 + musl fixes

diff --git a/libs/elfutils/BUILD b/libs/elfutils/BUILD
index 947a6c2..060baaa 100755
--- a/libs/elfutils/BUILD
+++ b/libs/elfutils/BUILD
@@ -1,3 +1,9 @@
+case "$HOST" in
+ *-musl)
+ LIBS+=" -lfts -lobstack" &&
+ export LIBS
+ ;;
+esac &&
#If these switches are used, they stop distcc and ccache from working
# We could write wrappers for all of the possible binaries
[[ $CROSS_INSTALL == on ]] && OPTS="$OPTS --host=${HOST} --build=${BUILD}"
@@ -8,6 +14,5 @@ OPTS="$OPTS --program-suffix=.elfutils" &&
disable_pic force &&
# Ensure at least some opts... buld fails with gcc-4.3 without opts.
# When user does -O0, she has to know why...
-CFLAGS="-O $CFLAGS" &&
OPTS+=" --disable-debuginfod" &&
default_build
diff --git a/libs/elfutils/DEPENDS b/libs/elfutils/DEPENDS
index ebdd396..b9d9d05 100755
--- a/libs/elfutils/DEPENDS
+++ b/libs/elfutils/DEPENDS
@@ -1,2 +1,9 @@
+case "$HOST" in
+ *-musl)
+ depends musl-fts &&
+ depends musl-obstack &&
+ depends libuargp
+ ;;
+esac &&
depends libtool &&
optional_depends GETTEXT '--enable-nls' '--disable-nls' 'NLS support'
diff --git a/libs/elfutils/HISTORY b/libs/elfutils/HISTORY
index 9e09ea9..e8b7f27 100644
--- a/libs/elfutils/HISTORY
+++ b/libs/elfutils/HISTORY
@@ -1,3 +1,11 @@
+2020-09-04 Ismael Luceno <ismael AT sourcemage.org>
+ * DETAILS: updated spell to 0.180
+ * BUILD, DEPENDS, PRE_BUILD, error.h, patches/fix-uninitialized.patch,
+ patches/musl-asm_ptrace_h.patch, patches/musl-cdefs.patch,
+ patches/musl-macros.patch, patches/musl-qsort_r.patch,
+ patches/musl-strerror_r.patch, patches/musl-strndupa.patch:
+ Fixed build against musl
+
2020-08-28 Treeve Jelbert <treeve AT sourcemage.org>
* DETAILS: version 0.180

diff --git a/libs/elfutils/PRE_BUILD b/libs/elfutils/PRE_BUILD
index 7eb680d..31edaed 100755
--- a/libs/elfutils/PRE_BUILD
+++ b/libs/elfutils/PRE_BUILD
@@ -1,8 +1,10 @@
default_pre_build &&
cd ${SOURCE_DIRECTORY} &&
-sed -i "s/-Werror//" */Makefile.in &&
-sedit "/^addr/s/)/) \$(libelf)/" src/Makefile.am &&
-sedit "/^line2addr_LDADD/s/)/) \$(libelf)/" tests/Makefile.am &&
-sedit "/^addrscopes/s/)/) \$(libelf)/" tests/Makefile.am &&
-sedit "/ifndef/s/PACKAGE/PACKAGE_NAME/" libdwfl/libdwflP.h
-
+apply_patch_dir patches &&
+case "$HOST" in
+ *-musl)
+ ln -s "$SPELL_DIRECTORY"/error.h lib &&
+ ln -s "$SPELL_DIRECTORY"/error.h src ;;
+esac &&
+sed -i '/^libdw_so_LDLIBS =/s/$/ $(LIBS)/' libdw/Makefile.in &&
+sed -i "s/-Werror//" */Makefile.in
diff --git a/libs/elfutils/error.h b/libs/elfutils/error.h
new file mode 100644
index 0000000..ef06827
--- /dev/null
+++ b/libs/elfutils/error.h
@@ -0,0 +1,27 @@
+#ifndef _ERROR_H_
+#define _ERROR_H_
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+
+static unsigned int error_message_count = 0;
+
+static inline void error(int status, int errnum, const char* format, ...)
+{
+ va_list ap;
+ fprintf(stderr, "%s: ", program_invocation_name);
+ va_start(ap, format);
+ vfprintf(stderr, format, ap);
+ va_end(ap);
+ if (errnum)
+ fprintf(stderr, ": %s", strerror(errnum));
+ fprintf(stderr, "\n");
+ error_message_count++;
+ if (status)
+ exit(status);
+}
+
+#endif /* _ERROR_H_ */
diff --git a/libs/elfutils/patches/fix-uninitialized.patch
b/libs/elfutils/patches/fix-uninitialized.patch
new file mode 100644
index 0000000..aa843d6
--- /dev/null
+++ b/libs/elfutils/patches/fix-uninitialized.patch
@@ -0,0 +1,18 @@
+Origin: Void-Linux
+
+--- a/libcpu/i386_disasm.c
++++ b/libcpu/i386_disasm.c
+@@ -1,4 +1,4 @@
+-/* Disassembler for x86.
++/* Disassembler for x86.
+ Copyright (C) 2007, 2008, 2009, 2011 Red Hat, Inc.
+ This file is part of elfutils.
+ Written by Ulrich Drepper <drepper AT redhat.com>, 2007.
+@@ -710,6 +710,7 @@
+
+ case 'm':
+ /* Mnemonic. */
++ str = mnebuf;
+
+ if (unlikely (instrtab[cnt].mnemonic == MNE_INVALID))
+ {
diff --git a/libs/elfutils/patches/musl-asm_ptrace_h.patch
b/libs/elfutils/patches/musl-asm_ptrace_h.patch
new file mode 100644
index 0000000..ae596e7
--- /dev/null
+++ b/libs/elfutils/patches/musl-asm_ptrace_h.patch
@@ -0,0 +1,12 @@
+Origin: Void-Linux
+
+--- a/backends/ppc_initreg.c
++++ b/backends/ppc_initreg.c
+@@ -32,6 +32,7 @@
+
+ #include <stdlib.h>
+ #if defined(__powerpc__) && defined(__linux__)
++# include <asm/ptrace.h>
+ # include <sys/ptrace.h>
+ # include <sys/user.h>
+ #endif
diff --git a/libs/elfutils/patches/musl-cdefs.patch
b/libs/elfutils/patches/musl-cdefs.patch
new file mode 100644
index 0000000..d5f5aa0
--- /dev/null
+++ b/libs/elfutils/patches/musl-cdefs.patch
@@ -0,0 +1,31 @@
+Origin: Void-Linux
+
+--- a/libelf/elf.h
++++ b/libelf/elf.h
+@@ -21,6 +21,16 @@
+
+ #include <features.h>
+
++#if !defined(__GLIBC__)
++#ifdef __cplusplus
++#define __BEGIN_DECLS extern "C" {
++#define __END_DECLS }
++#else
++#define __BEGIN_DECLS
++#define __END_DECLS
++#endif
++#endif
++
+ __BEGIN_DECLS
+
+ /* Standard ELF types. */
+--- 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/libs/elfutils/patches/musl-macros.patch
b/libs/elfutils/patches/musl-macros.patch
new file mode 100644
index 0000000..67f5345
--- /dev/null
+++ b/libs/elfutils/patches/musl-macros.patch
@@ -0,0 +1,55 @@
+Origin: Void-Linux
+
+--- a/src/arlib.h
++++ b/src/arlib.h
+@@ -29,6 +29,16 @@
+ #include <stdint.h>
+ #include <sys/types.h>
+
++#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 */
++#endif
++
+
+ /* State of -D/-U flags. */
+ extern bool arlib_deterministic_output;
+--- a/src/elfcompress.c
++++ b/src/elfcompress.c
+@@ -35,6 +35,14 @@
+ #include <gelf.h>
+ #include "system.h"
+
++#if !defined(FNM_EXTMATCH)
++#define FNM_EXTMATCH 0
++#endif
++
++#if !defined(ALLPERMS)
++#define ALLPERMS (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO) /* 07777
*/
++#endif
++
+ /* Name and version of program. */
+ static void print_version (FILE *stream, struct argp_state *state);
+ ARGP_PROGRAM_VERSION_HOOK_DEF = print_version;
+--- a/src/strip.c
++++ b/src/strip.c
+@@ -47,6 +47,14 @@
+ #include <system.h>
+ #include <printversion.h>
+
++#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;
+
+ /* Name and version of program. */
diff --git a/libs/elfutils/patches/musl-qsort_r.patch
b/libs/elfutils/patches/musl-qsort_r.patch
new file mode 100644
index 0000000..cde7e85
--- /dev/null
+++ b/libs/elfutils/patches/musl-qsort_r.patch
@@ -0,0 +1,34 @@
+Origin: Void-Linux; modified
+
+--- a/src/readelf.c
++++ b/src/readelf.c
+@@ -4773,10 +4773,12 @@ 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;
++ const char *name = listptr_name;
+ struct listptr *p1 = (void *) a;
+ struct listptr *p2 = (void *) b;
+
+@@ -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/libs/elfutils/patches/musl-strerror_r.patch
b/libs/elfutils/patches/musl-strerror_r.patch
new file mode 100644
index 0000000..9feb751
--- /dev/null
+++ b/libs/elfutils/patches/musl-strerror_r.patch
@@ -0,0 +1,21 @@
+Origin: Void-Linux
+
+--- a/libdwfl/dwfl_error.c
++++ b/libdwfl/dwfl_error.c
+@@ -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/libs/elfutils/patches/musl-strndupa.patch
b/libs/elfutils/patches/musl-strndupa.patch
new file mode 100644
index 0000000..50f0cea
--- /dev/null
+++ b/libs/elfutils/patches/musl-strndupa.patch
@@ -0,0 +1,20 @@
+Origin: Void-Linux
+
+--- a/src/unstrip.c
++++ b/src/unstrip.c
+@@ -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;
+



  • [SM-Commit] GIT changes to master grimoire by Ismael Luceno (2fe2edb5219d58091261ff31a326a7ee32af372c), Ismael Luceno, 09/04/2020

Archive powered by MHonArc 2.6.24.

Top of Page