All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] musl-obstack: Add recipe
@ 2019-05-22  1:32 Khem Raj
  2019-05-22  1:32 ` [PATCH 2/3] maintainers: Account for musl-obstack and libssp-nonshared Khem Raj
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Khem Raj @ 2019-05-22  1:32 UTC (permalink / raw)
  To: openembedded-core

obstacks from GNUlib is used in some OE-Core packages e.g. elfutils
and other packages outside OE-Core, this recipe helps provide this
functionality standalone on musl systems, and helps in getting full
versions of dependent packages

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-core/musl/musl-obstack.bb | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
 create mode 100644 meta/recipes-core/musl/musl-obstack.bb

diff --git a/meta/recipes-core/musl/musl-obstack.bb b/meta/recipes-core/musl/musl-obstack.bb
new file mode 100644
index 0000000000..9a9f04dac6
--- /dev/null
+++ b/meta/recipes-core/musl/musl-obstack.bb
@@ -0,0 +1,22 @@
+# Copyright (C) 2019 Khem Raj <raj.khem@gmail.com>
+# Released under the MIT license (see COPYING.MIT for the terms)
+
+SUMMARY = "A standalone library to implement GNU libc's obstack"
+DESCRIPTION = "copy + paste of the obstack functions and macros found in GNU gcc libiberty library for use with musl libc"
+HOMEPAGE = "https://github.com/pullmoll/musl-obstack"
+LICENSE = "GPL-2.0+"
+LIC_FILES_CHKSUM = "file://COPYING;md5=3d23e4eef8243efcaab6f0a438078932"
+SECTION = "libs"
+
+PV = "1.1"
+SRCREV = "d2ad66b0df44a4b784956f7f7f2717131ddc05f4"
+SRC_URI = "git://github.com/pullmoll/musl-obstack"
+
+UPSTREAM_CHECK_COMMITS = "1"
+
+inherit autotools
+
+S = "${WORKDIR}/git"
+
+COMPATIBLE_HOST = ".*-musl.*"
+
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/3] maintainers: Account for musl-obstack and libssp-nonshared
  2019-05-22  1:32 [PATCH 1/3] musl-obstack: Add recipe Khem Raj
@ 2019-05-22  1:32 ` Khem Raj
  2019-05-22  1:32 ` [PATCH 3/3] elfutils: Fix eu-* utils builds for musl Khem Raj
  2019-05-22 11:10 ` [PATCH 1/3] musl-obstack: Add recipe Richard Purdie
  2 siblings, 0 replies; 10+ messages in thread
From: Khem Raj @ 2019-05-22  1:32 UTC (permalink / raw)
  To: openembedded-core

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/conf/distro/include/maintainers.inc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/meta/conf/distro/include/maintainers.inc b/meta/conf/distro/include/maintainers.inc
index 67a51cdecc..2c10b104de 100644
--- a/meta/conf/distro/include/maintainers.inc
+++ b/meta/conf/distro/include/maintainers.inc
@@ -382,6 +382,7 @@ RECIPE_MAINTAINER_pn-libsm = "Armin Kuster <akuster808@gmail.com>"
 RECIPE_MAINTAINER_pn-libsndfile1 = "Tanu Kaskinen <tanuk@iki.fi>"
 RECIPE_MAINTAINER_pn-libsolv = "Anuj Mittal <anuj.mittal@intel.com>"
 RECIPE_MAINTAINER_pn-libsoup-2.4 = "Anuj Mittal <anuj.mittal@intel.com>"
+RECIPE_MAINTAINER_pn-libssp-nonshared = "Khem Raj <raj.khem@gmail.com>"
 RECIPE_MAINTAINER_pn-libtasn1 = "Anuj Mittal <anuj.mittal@intel.com>"
 RECIPE_MAINTAINER_pn-libtest-needs-perl = "Tim Orling <timothy.t.orling@linux.intel.com>"
 RECIPE_MAINTAINER_pn-libtheora = "Alexander Kanavin <alex.kanavin@gmail.com>"
@@ -512,6 +513,7 @@ RECIPE_MAINTAINER_pn-mtd-utils = "Denys Dmytriyenko <denys@ti.com>"
 RECIPE_MAINTAINER_pn-mtdev = "Anuj Mittal <anuj.mittal@intel.com>"
 RECIPE_MAINTAINER_pn-mtools = "Anuj Mittal <anuj.mittal@intel.com>"
 RECIPE_MAINTAINER_pn-musl = "Khem Raj <raj.khem@gmail.com>"
+RECIPE_MAINTAINER_pn-musl-obstack = "Khem Raj <raj.khem@gmail.com>"
 RECIPE_MAINTAINER_pn-musl-utils = "Khem Raj <raj.khem@gmail.com>"
 RECIPE_MAINTAINER_pn-mx-1.0 = "Anuj Mittal <anuj.mittal@intel.com>"
 RECIPE_MAINTAINER_pn-nasm = "Richard Purdie <richard.purdie@linuxfoundation.org>"
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 3/3] elfutils: Fix eu-* utils builds for musl
  2019-05-22  1:32 [PATCH 1/3] musl-obstack: Add recipe Khem Raj
  2019-05-22  1:32 ` [PATCH 2/3] maintainers: Account for musl-obstack and libssp-nonshared Khem Raj
@ 2019-05-22  1:32 ` Khem Raj
  2019-05-22  6:49   ` Adrian Bunk
  2019-05-22 11:10 ` [PATCH 1/3] musl-obstack: Add recipe Richard Purdie
  2 siblings, 1 reply; 10+ messages in thread
From: Khem Raj @ 2019-05-22  1:32 UTC (permalink / raw)
  To: openembedded-core

Re-organize the musl patches in three different areas namely
libs, utils and tests, this will help maintain them in future
version bumps

Add obstack dependency on musl targets which is needed for eu-*

PN and PN-binutils is not empty anymore on musl

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../elfutils/elfutils_0.176.bb                |  15 +-
 ...-err-variable-and-function-conflicts.patch |  91 --------
 ...ternatives-for-glibc-assumptions-hel.patch | 196 ------------------
 .../elfutils/files/musl-libs.patch            | 111 ++++++++++
 .../elfutils/files/musl-obstack-fts.patch     | 105 ++++++++++
 .../files/{musl.patch => musl-tests.patch}    |   0
 .../elfutils/files/musl-utils.patch           | 136 ++++++++++++
 7 files changed, 359 insertions(+), 295 deletions(-)
 delete mode 100644 meta/recipes-devtools/elfutils/files/0001-fix-err-variable-and-function-conflicts.patch
 delete mode 100644 meta/recipes-devtools/elfutils/files/0008-build-Provide-alternatives-for-glibc-assumptions-hel.patch
 create mode 100644 meta/recipes-devtools/elfutils/files/musl-libs.patch
 create mode 100644 meta/recipes-devtools/elfutils/files/musl-obstack-fts.patch
 rename meta/recipes-devtools/elfutils/files/{musl.patch => musl-tests.patch} (100%)
 create mode 100644 meta/recipes-devtools/elfutils/files/musl-utils.patch

diff --git a/meta/recipes-devtools/elfutils/elfutils_0.176.bb b/meta/recipes-devtools/elfutils/elfutils_0.176.bb
index 157551e6af..1729e44d5f 100644
--- a/meta/recipes-devtools/elfutils/elfutils_0.176.bb
+++ b/meta/recipes-devtools/elfutils/elfutils_0.176.bb
@@ -4,7 +4,7 @@ SECTION = "base"
 LICENSE = "GPLv2 & LGPLv3+ & GPLv3+"
 LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504"
 DEPENDS = "libtool bzip2 zlib virtual/libintl"
-DEPENDS_append_libc-musl = " argp-standalone fts "
+DEPENDS_append_libc-musl = " argp-standalone fts musl-obstack "
 # The Debian patches below are from:
 # http://ftp.de.debian.org/debian/pool/main/e/elfutils/elfutils_0.175-1.debian.tar.xz
 SRC_URI = "https://sourceware.org/elfutils/ftp/${PV}/${BP}.tar.bz2 \
@@ -31,12 +31,13 @@ SRC_URI = "https://sourceware.org/elfutils/ftp/${PV}/${BP}.tar.bz2 \
            file://0001-skip-the-test-when-gcc-not-deployed.patch \
            file://run-ptest \
            file://ptest.patch \
-           file://musl.patch \
            "
-SRC_URI_append_libc-musl = " file://0008-build-Provide-alternatives-for-glibc-assumptions-hel.patch \
-                             file://0001-fix-err-variable-and-function-conflicts.patch \
-"
-
+SRC_URI_append_libc-musl = " \
+           file://musl-obstack-fts.patch \
+           file://musl-libs.patch \
+           file://musl-utils.patch \
+           file://musl-tests.patch \
+           "
 SRC_URI[md5sum] = "077e4f49320cad82bf17a997068b1db9"
 SRC_URI[sha256sum] = "eb5747c371b0af0f71e86215a5ebb88728533c3a104a43d4231963f308cd1023"
 
@@ -73,8 +74,6 @@ do_install_ptest() {
 EXTRA_OEMAKE_class-native = ""
 EXTRA_OEMAKE_class-nativesdk = ""
 
-ALLOW_EMPTY_${PN}_libc-musl = "1"
-
 BBCLASSEXTEND = "native nativesdk"
 
 # Package utilities separately
diff --git a/meta/recipes-devtools/elfutils/files/0001-fix-err-variable-and-function-conflicts.patch b/meta/recipes-devtools/elfutils/files/0001-fix-err-variable-and-function-conflicts.patch
deleted file mode 100644
index 433db133b2..0000000000
--- a/meta/recipes-devtools/elfutils/files/0001-fix-err-variable-and-function-conflicts.patch
+++ /dev/null
@@ -1,91 +0,0 @@
-From 2c50fe7068bd6911958c6d851aef88179e73bb21 Mon Sep 17 00:00:00 2001
-From: Mingli Yu <Mingli.Yu@windriver.com>
-Date: Tue, 16 Apr 2019 15:30:38 +0800
-Subject: [PATCH] fix err variable and function conflicts
-
-There comes below build failure with musl when
-ptest enabled.
-| In file included from ../../elfutils-0.176/tests/dwfl-proc-attach.c:33:
-| ../../elfutils-0.176/lib/system.h:63:35: error: called object 'err' is not a function or function pointer
-|  #define error(status, errno, ...) err(status, __VA_ARGS__)
-|                                    ^~~
-| ../../elfutils-0.176/tests/dwfl-proc-attach.c:92:5: note: in expansion of macro 'error'
-|      error (-1, 0, "dwfl_linux_proc_attach pid %d: %s", pid,
-|      ^~~~~
-| ../../elfutils-0.176/tests/dwfl-proc-attach.c:79:7: note: declared here
-|    int err;
-|        ^~~
-
-It is because there is no error.h in musl and
-the patch 0008-build-Provide-alternatives-for-glibc-assumptions-hel.patch
-has updated to use err.h to replace error.h
-and also added macro definiton as below when
-use musl.
- #define error(status, errno, ...) err(status, __VA_ARGS__)
-
-And in err.h, there is below logic:
-_Noreturn void err(int, const char *, ...);
-
-But when ptest enabled, there comes below error
-as there is both variable and function defined
-to be err in tests/dwfl-proc-attach.c.
-So change the err variable's name to workaround
-the build failure with musl.
-
-Upstream-Status: Inappropriate [workaround in musl]
-
-Signed-off-by: Mingli Yu <Mingli.Yu@windriver.com>
----
- tests/dwfl-proc-attach.c | 6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
-
-Index: elfutils-0.176/tests/dwfl-proc-attach.c
-===================================================================
---- elfutils-0.176.orig/tests/dwfl-proc-attach.c
-+++ elfutils-0.176/tests/dwfl-proc-attach.c
-@@ -76,10 +76,10 @@ main (int argc __attribute__ ((unused)),
-       char **argv __attribute__ ((unused)))
- {
-   /* Create two extra threads to iterate through.  */
--  int err;
--  if ((err = pthread_create (&thread1, NULL, sleeper, NULL)) != 0)
-+  int err1;
-+  if ((err1 = pthread_create (&thread1, NULL, sleeper, NULL)) != 0)
-     error (-1, err, "Couldn't create thread1");
--  if ((err = pthread_create (&thread2, NULL, sleeper, NULL)) != 0)
-+  if ((err1 = pthread_create (&thread2, NULL, sleeper, NULL)) != 0)
-     error (-1, err, "Couldn't create thread2");
- 
-   Dwfl *dwfl = dwfl_begin (&proc_callbacks);
-Index: elfutils-0.176/tests/backtrace.c
-===================================================================
---- elfutils-0.176.orig/tests/backtrace.c
-+++ elfutils-0.176/tests/backtrace.c
-@@ -219,23 +219,23 @@ dump (Dwfl *dwfl)
- {
-   ptrdiff_t ptrdiff = dwfl_getmodules (dwfl, dump_modules, NULL, 0);
-   assert (ptrdiff == 0);
--  bool err = false;
-+  bool err1 = false;
-   switch (dwfl_getthreads (dwfl, thread_callback, NULL))
-     {
-     case 0:
-       break;
-     case DWARF_CB_ABORT:
--      err = true;
-+      err1 = true;
-       break;
-     case -1:
-       error (0, 0, "dwfl_getthreads: %s", dwfl_errmsg (-1));
--      err = true;
-+      err1 = true;
-       break;
-     default:
-       abort ();
-     }
-   callback_verify (0, 0, 0, NULL, dwfl);
--  if (err)
-+  if (err1)
-     exit (EXIT_FAILURE);
- }
- 
diff --git a/meta/recipes-devtools/elfutils/files/0008-build-Provide-alternatives-for-glibc-assumptions-hel.patch b/meta/recipes-devtools/elfutils/files/0008-build-Provide-alternatives-for-glibc-assumptions-hel.patch
deleted file mode 100644
index 10cdac646c..0000000000
--- a/meta/recipes-devtools/elfutils/files/0008-build-Provide-alternatives-for-glibc-assumptions-hel.patch
+++ /dev/null
@@ -1,196 +0,0 @@
-From 990d377a92f4bab04bf6820fc81b3dcb6cf5e31d Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Mon, 2 Jul 2018 09:52:23 +0800
-Subject: [PATCH] build: Provide alternatives for glibc assumptions helps
- compiling it on musl
-
-Upstream-Status: Pending
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
-
-Rebase to 0.175
-
-Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
-
----
- Makefile.am                      |  2 +-
- lib/fixedsizehash.h              |  1 -
- lib/system.h                     | 12 +++++++++++-
- libdw/Makefile.am                |  3 ++-
- libdwfl/dwfl_build_id_find_elf.c |  1 +
- libdwfl/dwfl_error.c             |  4 +++-
- libdwfl/dwfl_module_getdwarf.c   |  1 +
- libdwfl/libdwfl_crc32_file.c     |  9 +++++++++
- libdwfl/linux-kernel-modules.c   |  1 +
- libelf/elf.h                     |  8 ++++++--
- libelf/libelf.h                  |  1 +
- libelf/libelfP.h                 |  1 +
- 12 files changed, 37 insertions(+), 7 deletions(-)
-
-diff --git a/Makefile.am b/Makefile.am
-index 2ff444e..41f77df 100644
---- a/Makefile.am
-+++ b/Makefile.am
-@@ -28,7 +28,7 @@ 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
-+	  backends po tests
- 
- EXTRA_DIST = elfutils.spec GPG-KEY NOTES CONTRIBUTING \
- 	     COPYING COPYING-GPLV2 COPYING-LGPLV3
-diff --git a/lib/fixedsizehash.h b/lib/fixedsizehash.h
-index dac2a5f..43016fc 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/lib/system.h b/lib/system.h
-index 292082b..308a762 100644
---- a/lib/system.h
-+++ b/lib/system.h
-@@ -30,7 +30,7 @@
- #define LIB_SYSTEM_H	1
- 
- #include <errno.h>
--#include <error.h>
-+#include <err.h>
- #include <stddef.h>
- #include <stdint.h>
- #include <sys/param.h>
-@@ -51,6 +51,8 @@
- #else
- # error "Unknown byte order"
- #endif
-+
-+#define error(status, errno, ...) err(status, __VA_ARGS__)
- 
- #ifndef MAX
- #define MAX(m, n) ((m) < (n) ? (n) : (m))
-diff --git a/libdw/Makefile.am b/libdw/Makefile.am
-index 7a3d532..7ac1241 100644
---- a/libdw/Makefile.am
-+++ b/libdw/Makefile.am
-@@ -108,7 +108,8 @@ am_libdw_pic_a_OBJECTS = $(libdw_a_SOURCES:.c=.os)
- libdw_so_LIBS = libdw_pic.a ../libdwelf/libdwelf_pic.a \
- 	  ../libdwfl/libdwfl_pic.a ../libebl/libebl.a
- libdw_so_DEPS = ../lib/libeu.a ../libelf/libelf.so
--libdw_so_LDLIBS = $(libdw_so_DEPS) -ldl -lz $(argp_LDADD) $(zip_LIBS)
-+fts_LDADD = -lfts
-+libdw_so_LDLIBS = $(libdw_so_DEPS) -ldl -lz $(argp_LDADD) $(zip_LIBS) $(fts_LDADD)
- libdw_so_SOURCES =
- libdw.so$(EXEEXT): $(srcdir)/libdw.map $(libdw_so_LIBS) $(libdw_so_DEPS)
- # The rpath is necessary for libebl because its $ORIGIN use will
-diff --git a/libdwfl/dwfl_build_id_find_elf.c b/libdwfl/dwfl_build_id_find_elf.c
-index cc6c3f6..b06ab59 100644
---- a/libdwfl/dwfl_build_id_find_elf.c
-+++ b/libdwfl/dwfl_build_id_find_elf.c
-@@ -31,6 +31,7 @@
- #endif
- 
- #include "libdwflP.h"
-+#include "system.h"
- #include <inttypes.h>
- #include <fcntl.h>
- #include <unistd.h>
-diff --git a/libdwfl/dwfl_error.c b/libdwfl/dwfl_error.c
-index 7bcf61c..c345797 100644
---- a/libdwfl/dwfl_error.c
-+++ b/libdwfl/dwfl_error.c
-@@ -140,6 +140,7 @@ __libdwfl_seterrno (Dwfl_Error error)
- const char *
- dwfl_errmsg (int error)
- {
-+  static __thread char s[64] = "";
-   if (error == 0 || error == -1)
-     {
-       int last_error = global_error;
-@@ -154,7 +155,8 @@ dwfl_errmsg (int error)
-   switch (error &~ 0xffff)
-     {
-     case OTHER_ERROR (ERRNO):
--      return strerror_r (error & 0xffff, "bad", 0);
-+      strerror_r (error & 0xffff, s, sizeof(s));
-+      return s;
-     case OTHER_ERROR (LIBELF):
-       return elf_errmsg (error & 0xffff);
-     case OTHER_ERROR (LIBDW):
-diff --git a/libdwfl/dwfl_module_getdwarf.c b/libdwfl/dwfl_module_getdwarf.c
-index 56e6105..f4a0649 100644
---- a/libdwfl/dwfl_module_getdwarf.c
-+++ b/libdwfl/dwfl_module_getdwarf.c
-@@ -35,6 +35,7 @@
- #include <fcntl.h>
- #include <string.h>
- #include <unistd.h>
-+#include "system.h"
- #include "../libdw/libdwP.h"	/* DWARF_E_* values are here.  */
- #include "../libelf/libelfP.h"
- #include "system.h"
-diff --git a/libdwfl/linux-kernel-modules.c b/libdwfl/linux-kernel-modules.c
-index 360e4ee..b5aa397 100644
---- a/libdwfl/linux-kernel-modules.c
-+++ b/libdwfl/linux-kernel-modules.c
-@@ -41,6 +41,7 @@
- 
- #include "libelfP.h"
- #include "libdwflP.h"
-+#include "system.h"
- #include <inttypes.h>
- #include <errno.h>
- #include <stdio.h>
-diff --git a/libelf/elf.h b/libelf/elf.h
-index 5dc632b..14da1b7 100644
---- a/libelf/elf.h
-+++ b/libelf/elf.h
-@@ -21,7 +21,9 @@
- 
- #include <features.h>
- 
--__BEGIN_DECLS
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
- 
- /* Standard ELF types.  */
- 
-@@ -3937,6 +3939,8 @@ enum
- #define R_METAG_TLS_LE_HI16	60
- #define R_METAG_TLS_LE_LO16	61
- 
--__END_DECLS
-+#ifdef __cplusplus
-+}
-+#endif
- 
- #endif	/* elf.h */
-diff --git a/libelf/libelf.h b/libelf/libelf.h
-index 1ff11c9..c21e018 100644
---- a/libelf/libelf.h
-+++ b/libelf/libelf.h
-@@ -29,6 +29,7 @@
- #ifndef _LIBELF_H
- #define _LIBELF_H 1
- 
-+#include <fcntl.h>
- #include <stdint.h>
- #include <sys/types.h>
- 
-diff --git a/libelf/libelfP.h b/libelf/libelfP.h
-index 9f3e8e9..10a347a 100644
---- a/libelf/libelfP.h
-+++ b/libelf/libelfP.h
-@@ -32,6 +32,7 @@
- 
- #include <ar.h>
- #include <gelf.h>
-+#include <libelf.h>
- 
- #include <errno.h>
- #include <stdbool.h>
diff --git a/meta/recipes-devtools/elfutils/files/musl-libs.patch b/meta/recipes-devtools/elfutils/files/musl-libs.patch
new file mode 100644
index 0000000000..51ca630ef8
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/files/musl-libs.patch
@@ -0,0 +1,111 @@
+Collection of fixes needed to compile libelf and other libraries
+provided by elfutils for musl targets
+
+error is glibc specific API, so this patch will mostly not accepted
+upstream given that elfutils has been closely tied to glibc
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Upstream-Status: Inappropriate [workaround for musl]
+
+--- /dev/null
++++ b/lib/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_ */
+--- 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/lib/libeu.h
++++ b/lib/libeu.h
+@@ -29,6 +29,7 @@
+ #ifndef LIBEU_H
+ #define LIBEU_H
+ 
++#include "system.h"
+ #include <stddef.h>
+ #include <stdint.h>
+ 
+--- a/libdwfl/dwfl_error.c
++++ b/libdwfl/dwfl_error.c
+@@ -154,7 +154,16 @@ dwfl_errmsg (int error)
+   switch (error &~ 0xffff)
+     {
+     case OTHER_ERROR (ERRNO):
++#if defined(__GLIBC__)
+       return strerror_r (error & 0xffff, "bad", 0);
++#else
++      {
++        static __thread char buf[128] = "";
++        if (strerror_r (error & 0xffff, buf, sizeof(buf)) == 0)
++          return buf;
++      }
++      return "strerror_r() failed";
++#endif
+     case OTHER_ERROR (LIBELF):
+       return elf_errmsg (error & 0xffff);
+     case OTHER_ERROR (LIBDW):
+--- a/libdwfl/linux-kernel-modules.c
++++ b/libdwfl/linux-kernel-modules.c
+@@ -50,6 +50,7 @@
+ #include <sys/utsname.h>
+ #include <fcntl.h>
+ #include <unistd.h>
++#include "system.h"
+ 
+ /* If fts.h is included before config.h, its indirect inclusions may not
+    give us the right LFS aliases of these functions, so map them manually.  */
+--- a/libelf/elf.h
++++ b/libelf/elf.h
+@@ -21,7 +21,9 @@
+ 
+ #include <features.h>
+ 
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
+ 
+ /* Standard ELF types.  */
+ 
+@@ -3937,6 +3939,7 @@ enum
+ #define R_METAG_TLS_LE_HI16	60
+ #define R_METAG_TLS_LE_LO16	61
+ 
+-__END_DECLS
+-
++#ifdef __cplusplus
++}
++#endif
+ #endif	/* elf.h */
diff --git a/meta/recipes-devtools/elfutils/files/musl-obstack-fts.patch b/meta/recipes-devtools/elfutils/files/musl-obstack-fts.patch
new file mode 100644
index 0000000000..0fb7eb9236
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/files/musl-obstack-fts.patch
@@ -0,0 +1,105 @@
+Look for libfts and libobstack during configure, these
+libraries are external to libc when using musl, whereas
+on glibc these libraries are provided in libc itself.
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Upstream-Status: Inappropriate [workaround for musl]
+--- a/configure.ac
++++ b/configure.ac
+@@ -494,6 +494,60 @@ else
+ 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 Documentation.
+--- a/libdw/Makefile.am
++++ b/libdw/Makefile.am
+@@ -108,7 +108,7 @@ am_libdw_pic_a_OBJECTS = $(libdw_a_SOURC
+ libdw_so_LIBS = libdw_pic.a ../libdwelf/libdwelf_pic.a \
+ 	  ../libdwfl/libdwfl_pic.a ../libebl/libebl.a
+ libdw_so_DEPS = ../lib/libeu.a ../libelf/libelf.so
+-libdw_so_LDLIBS = $(libdw_so_DEPS) -ldl -lz $(argp_LDADD) $(zip_LIBS)
++libdw_so_LDLIBS = $(libdw_so_DEPS) -ldl -lz $(argp_LDADD) $(fts_LDADD) $(zip_LIBS)
+ libdw_so_SOURCES =
+ libdw.so$(EXEEXT): $(srcdir)/libdw.map $(libdw_so_LIBS) $(libdw_so_DEPS)
+ # The rpath is necessary for libebl because its $ORIGIN use will
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -68,8 +68,8 @@ ar_no_Wstack_usage = yes
+ unstrip_no_Wstack_usage = yes
+ 
+ readelf_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(argp_LDADD) -ldl
+-nm_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(argp_LDADD) -ldl \
+-	   $(demanglelib)
++nm_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(argp_LDADD) \
++	   $(obstack_LDADD) -ldl $(demanglelib)
+ size_LDADD = $(libelf) $(libeu) $(argp_LDADD)
+ strip_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD) -ldl
+ elflint_LDADD  = $(libebl) $(libelf) $(libeu) $(argp_LDADD) -ldl
+@@ -77,9 +77,9 @@ findtextrel_LDADD = $(libdw) $(libelf) $
+ addr2line_LDADD = $(libdw) $(libelf) $(libeu) $(argp_LDADD) $(demanglelib)
+ elfcmp_LDADD = $(libebl) $(libelf) $(libeu) $(argp_LDADD) -ldl
+ objdump_LDADD  = $(libasm) $(libebl) $(libelf) $(libeu) $(argp_LDADD) -ldl
+-ranlib_LDADD = libar.a $(libelf) $(libeu) $(argp_LDADD)
++ranlib_LDADD = libar.a $(libelf) $(libeu) $(argp_LDADD) $(obstack_LDADD)
+ strings_LDADD = $(libelf) $(libeu) $(argp_LDADD)
+-ar_LDADD = libar.a $(libelf) $(libeu) $(argp_LDADD)
++ar_LDADD = libar.a $(libelf) $(libeu) $(argp_LDADD) $(obstack_LDADD)
+ unstrip_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD) -ldl
+ stack_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD) -ldl $(demanglelib)
+ elfcompress_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD)
diff --git a/meta/recipes-devtools/elfutils/files/musl.patch b/meta/recipes-devtools/elfutils/files/musl-tests.patch
similarity index 100%
rename from meta/recipes-devtools/elfutils/files/musl.patch
rename to meta/recipes-devtools/elfutils/files/musl-tests.patch
diff --git a/meta/recipes-devtools/elfutils/files/musl-utils.patch b/meta/recipes-devtools/elfutils/files/musl-utils.patch
new file mode 100644
index 0000000000..4547bbbf16
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/files/musl-utils.patch
@@ -0,0 +1,136 @@
+Provide missing defines which otherwise are available on glibc system headers
+
+Alter the error API to match posix version
+use qsort instead of qsort_r which is glibc specific API
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Upstream-Status: Inappropriate [workaround for musl]
+--- a/src/arlib.h
++++ b/src/arlib.h
+@@ -29,6 +29,12 @@
+ #include <stdint.h>
+ #include <sys/types.h>
+ 
++#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
+@@ -37,6 +37,13 @@
+ #include "libeu.h"
+ #include "printversion.h"
+ 
++#if !defined(ALLPERMS)
++# define ALLPERMS (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO) /* 07777 */
++#endif
++#if !defined(FNM_EXTMATCH)
++# define FNM_EXTMATCH ( 1 << 5)
++#endif
++
+ /* Name and version of program.  */
+ ARGP_PROGRAM_VERSION_HOOK_DEF = print_version;
+ 
+--- a/src/readelf.c
++++ b/src/readelf.c
+@@ -4792,10 +4792,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;
+ 
+@@ -4811,21 +4812,21 @@ compare_listptr (const void *a, const vo
+ 	  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)
+ 	{
+@@ -4833,7 +4834,7 @@ compare_listptr (const void *a, const vo
+ 	  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));
+ 	}
+     }
+@@ -4905,8 +4906,11 @@ 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);
++    {
++      listptr_name = name;
++      qsort (table->table, table->n, sizeof table->table[0],
++	    &compare_listptr);
++    }
+ }
+ 
+ static bool
+--- a/src/strip.c
++++ b/src/strip.c
+@@ -46,6 +46,13 @@
+ #include <system.h>
+ #include <printversion.h>
+ 
++#if !defined(ACCESSPERMS)
++# define ACCESSPERMS (S_IRWXU|S_IRWXG|S_IRWXO) /* 0777 */
++#endif
++#if !defined(FNM_EXTMATCH)
++# define FNM_EXTMATCH (1 << 5) /* Use ksh-like extended matching. */
++#endif
++
+ typedef uint8_t GElf_Byte;
+ 
+ /* Name and version of program.  */
+--- a/src/unstrip.c
++++ b/src/unstrip.c
+@@ -56,6 +56,15 @@
+ # define _(str) gettext (str)
+ #endif
+ 
++#ifndef strndupa
++#define strndupa(s, n) \
++       ({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;
+ 
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 3/3] elfutils: Fix eu-* utils builds for musl
  2019-05-22  1:32 ` [PATCH 3/3] elfutils: Fix eu-* utils builds for musl Khem Raj
@ 2019-05-22  6:49   ` Adrian Bunk
  2019-05-22 23:29     ` Khem Raj
  0 siblings, 1 reply; 10+ messages in thread
From: Adrian Bunk @ 2019-05-22  6:49 UTC (permalink / raw)
  To: Khem Raj; +Cc: openembedded-core

On Tue, May 21, 2019 at 06:32:28PM -0700, Khem Raj wrote:
>...
> PN and PN-binutils is not empty anymore on musl
>...
> ++#if !defined(FNM_EXTMATCH)
> ++# define FNM_EXTMATCH (1 << 5) /* Use ksh-like extended matching. */
> ++#endif
>...

This might fix the compilation, but it is horribly wrong.

It passes a flag to a function that this function does not understand.

In the best case the function returns with an error on unknown flags.

In the worst case the function does silently something different from
what the caller expects it to do.

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/3] musl-obstack: Add recipe
  2019-05-22  1:32 [PATCH 1/3] musl-obstack: Add recipe Khem Raj
  2019-05-22  1:32 ` [PATCH 2/3] maintainers: Account for musl-obstack and libssp-nonshared Khem Raj
  2019-05-22  1:32 ` [PATCH 3/3] elfutils: Fix eu-* utils builds for musl Khem Raj
@ 2019-05-22 11:10 ` Richard Purdie
  2019-05-22 15:39   ` Khem Raj
  2 siblings, 1 reply; 10+ messages in thread
From: Richard Purdie @ 2019-05-22 11:10 UTC (permalink / raw)
  To: Khem Raj, openembedded-core

On Tue, 2019-05-21 at 18:32 -0700, Khem Raj wrote:
> obstacks from GNUlib is used in some OE-Core packages e.g. elfutils
> and other packages outside OE-Core, this recipe helps provide this
> functionality standalone on musl systems, and helps in getting full
> versions of dependent packages
> 
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> ---
>  meta/recipes-core/musl/musl-obstack.bb | 22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
>  create mode 100644 meta/recipes-core/musl/musl-obstack.bb

https://autobuilder.yoctoproject.org/typhoon/#/builders/64/builds/623

Cheers,

Richard



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/3] musl-obstack: Add recipe
  2019-05-22 11:10 ` [PATCH 1/3] musl-obstack: Add recipe Richard Purdie
@ 2019-05-22 15:39   ` Khem Raj
  0 siblings, 0 replies; 10+ messages in thread
From: Khem Raj @ 2019-05-22 15:39 UTC (permalink / raw)
  To: Richard Purdie; +Cc: Patches and discussions about the oe-core layer

On Wed, May 22, 2019 at 4:10 AM Richard Purdie
<richard.purdie@linuxfoundation.org> wrote:
>
> On Tue, 2019-05-21 at 18:32 -0700, Khem Raj wrote:
> > obstacks from GNUlib is used in some OE-Core packages e.g. elfutils
> > and other packages outside OE-Core, this recipe helps provide this
> > functionality standalone on musl systems, and helps in getting full
> > versions of dependent packages
> >
> > Signed-off-by: Khem Raj <raj.khem@gmail.com>
> > ---
> >  meta/recipes-core/musl/musl-obstack.bb | 22 ++++++++++++++++++++++
> >  1 file changed, 22 insertions(+)
> >  create mode 100644 meta/recipes-core/musl/musl-obstack.bb
>
> https://autobuilder.yoctoproject.org/typhoon/#/builders/64/builds/623
>

this was due to missing pkgconfig inherit I believe.  I have sent a v2 now see

https://patchwork.openembedded.org/patch/161515/

> Cheers,
>
> Richard
>


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 3/3] elfutils: Fix eu-* utils builds for musl
  2019-05-22  6:49   ` Adrian Bunk
@ 2019-05-22 23:29     ` Khem Raj
  2019-05-23  6:10       ` Adrian Bunk
  0 siblings, 1 reply; 10+ messages in thread
From: Khem Raj @ 2019-05-22 23:29 UTC (permalink / raw)
  To: Adrian Bunk; +Cc: Patches and discussions about the oe-core layer

On Tue, May 21, 2019 at 11:49 PM Adrian Bunk <bunk@stusta.de> wrote:
>
> On Tue, May 21, 2019 at 06:32:28PM -0700, Khem Raj wrote:
> >...
> > PN and PN-binutils is not empty anymore on musl
> >...
> > ++#if !defined(FNM_EXTMATCH)
> > ++# define FNM_EXTMATCH (1 << 5) /* Use ksh-like extended matching. */
> > ++#endif
> >...
>
> This might fix the compilation, but it is horribly wrong.
>
> It passes a flag to a function that this function does not understand.
>
> In the best case the function returns with an error on unknown flags.
>
> In the worst case the function does silently something different from
> what the caller expects it to do.
>

I forgot that the API is provided by libc here so mimic'ing the define
infact could
cause pain. I think its better to nullify it in this case where it is
being used in these
files.


> cu
> Adrian
>
> --
>
>        "Is there not promise of rain?" Ling Tan asked suddenly out
>         of the darkness. There had been need of rain for many days.
>        "Only a promise," Lao Er said.
>                                        Pearl S. Buck - Dragon Seed
>


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 3/3] elfutils: Fix eu-* utils builds for musl
  2019-05-22 23:29     ` Khem Raj
@ 2019-05-23  6:10       ` Adrian Bunk
  2019-05-23 13:52         ` Khem Raj
  0 siblings, 1 reply; 10+ messages in thread
From: Adrian Bunk @ 2019-05-23  6:10 UTC (permalink / raw)
  To: Khem Raj; +Cc: Patches and discussions about the oe-core layer

On Wed, May 22, 2019 at 04:29:33PM -0700, Khem Raj wrote:
> On Tue, May 21, 2019 at 11:49 PM Adrian Bunk <bunk@stusta.de> wrote:
> >
> > On Tue, May 21, 2019 at 06:32:28PM -0700, Khem Raj wrote:
> > >...
> > > PN and PN-binutils is not empty anymore on musl
> > >...
> > > ++#if !defined(FNM_EXTMATCH)
> > > ++# define FNM_EXTMATCH (1 << 5) /* Use ksh-like extended matching. */
> > > ++#endif
> > >...
> >
> > This might fix the compilation, but it is horribly wrong.
> >
> > It passes a flag to a function that this function does not understand.
> >
> > In the best case the function returns with an error on unknown flags.
> >
> > In the worst case the function does silently something different from
> > what the caller expects it to do.
> >
> 
> I forgot that the API is provided by libc here so mimic'ing the define
> infact could
> cause pain. I think its better to nullify it in this case where it is
> being used in these
> files.

Just looking at the usage in src/elfcompress.c, my first impression is 
that this tool is mostly useless without a properly working FNM_EXTMATCH.

Are the eu-* utils actually important in the cases where space is so 
limited that people are forced to use musl instead of glibc?

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 3/3] elfutils: Fix eu-* utils builds for musl
  2019-05-23  6:10       ` Adrian Bunk
@ 2019-05-23 13:52         ` Khem Raj
  2019-05-23 15:37           ` Adrian Bunk
  0 siblings, 1 reply; 10+ messages in thread
From: Khem Raj @ 2019-05-23 13:52 UTC (permalink / raw)
  To: Adrian Bunk; +Cc: Patches and discussions about the oe-core layer

[-- Attachment #1: Type: text/plain, Size: 1791 bytes --]

On Wed, May 22, 2019 at 11:10 PM Adrian Bunk <bunk@stusta.de> wrote:

> On Wed, May 22, 2019 at 04:29:33PM -0700, Khem Raj wrote:
> > On Tue, May 21, 2019 at 11:49 PM Adrian Bunk <bunk@stusta.de> wrote:
> > >
> > > On Tue, May 21, 2019 at 06:32:28PM -0700, Khem Raj wrote:
> > > >...
> > > > PN and PN-binutils is not empty anymore on musl
> > > >...
> > > > ++#if !defined(FNM_EXTMATCH)
> > > > ++# define FNM_EXTMATCH (1 << 5) /* Use ksh-like extended matching.
> */
> > > > ++#endif
> > > >...
> > >
> > > This might fix the compilation, but it is horribly wrong.
> > >
> > > It passes a flag to a function that this function does not understand.
> > >
> > > In the best case the function returns with an error on unknown flags.
> > >
> > > In the worst case the function does silently something different from
> > > what the caller expects it to do.
> > >
> >
> > I forgot that the API is provided by libc here so mimic'ing the define
> > infact could
> > cause pain. I think its better to nullify it in this case where it is
> > being used in these
> > files.
>
> Just looking at the usage in src/elfcompress.c, my first impression is
> that this tool is mostly useless without a properly working FNM_EXTMATCH.
>
> Are the eu-* utils actually important in the cases where space is so
> limited that people are forced to use musl instead of glibc?
>
>
They are primarily needed for testing and now we have good auto testing
infra it would be good to build them

cu
> Adrian
>
> --
>
>        "Is there not promise of rain?" Ling Tan asked suddenly out
>         of the darkness. There had been need of rain for many days.
>        "Only a promise," Lao Er said.
>                                        Pearl S. Buck - Dragon Seed
>
>

[-- Attachment #2: Type: text/html, Size: 2604 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 3/3] elfutils: Fix eu-* utils builds for musl
  2019-05-23 13:52         ` Khem Raj
@ 2019-05-23 15:37           ` Adrian Bunk
  0 siblings, 0 replies; 10+ messages in thread
From: Adrian Bunk @ 2019-05-23 15:37 UTC (permalink / raw)
  To: Khem Raj; +Cc: Patches and discussions about the oe-core layer

On Thu, May 23, 2019 at 06:52:23AM -0700, Khem Raj wrote:
> On Wed, May 22, 2019 at 11:10 PM Adrian Bunk <bunk@stusta.de> wrote:
> 
> > On Wed, May 22, 2019 at 04:29:33PM -0700, Khem Raj wrote:
> > > On Tue, May 21, 2019 at 11:49 PM Adrian Bunk <bunk@stusta.de> wrote:
> > > >
> > > > On Tue, May 21, 2019 at 06:32:28PM -0700, Khem Raj wrote:
> > > > >...
> > > > > PN and PN-binutils is not empty anymore on musl
> > > > >...
> > > > > ++#if !defined(FNM_EXTMATCH)
> > > > > ++# define FNM_EXTMATCH (1 << 5) /* Use ksh-like extended matching.
> > */
> > > > > ++#endif
> > > > >...
> > > >
> > > > This might fix the compilation, but it is horribly wrong.
> > > >
> > > > It passes a flag to a function that this function does not understand.
> > > >
> > > > In the best case the function returns with an error on unknown flags.
> > > >
> > > > In the worst case the function does silently something different from
> > > > what the caller expects it to do.
> > > >
> > >
> > > I forgot that the API is provided by libc here so mimic'ing the define
> > > infact could
> > > cause pain. I think its better to nullify it in this case where it is
> > > being used in these
> > > files.
> >
> > Just looking at the usage in src/elfcompress.c, my first impression is
> > that this tool is mostly useless without a properly working FNM_EXTMATCH.
> >
> > Are the eu-* utils actually important in the cases where space is so
> > limited that people are forced to use musl instead of glibc?
> >
> >
> They are primarily needed for testing and now we have good auto testing
> infra it would be good to build them

Known-broken code is not a good basis for testing.

When I build elfutils locally on my x86_64 desktop and run "make check"
all tests pass (with 3 skipped tests).

Adding
  #undef FNM_EXTMATCH
  #define FNM_EXTMATCH 0
to the defines in src/elfcompress.c gives me one test failure.

That could have easily been a day wasted by someone debugging why this 
test failed with musl.

If these tests are really important the fnmatch replacement from gnulib 
might help, similar to the other cases where missing functionality is 
added from gnulib to add functionality for musl builds (e.g. argp, fts).

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2019-05-23 15:37 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-22  1:32 [PATCH 1/3] musl-obstack: Add recipe Khem Raj
2019-05-22  1:32 ` [PATCH 2/3] maintainers: Account for musl-obstack and libssp-nonshared Khem Raj
2019-05-22  1:32 ` [PATCH 3/3] elfutils: Fix eu-* utils builds for musl Khem Raj
2019-05-22  6:49   ` Adrian Bunk
2019-05-22 23:29     ` Khem Raj
2019-05-23  6:10       ` Adrian Bunk
2019-05-23 13:52         ` Khem Raj
2019-05-23 15:37           ` Adrian Bunk
2019-05-22 11:10 ` [PATCH 1/3] musl-obstack: Add recipe Richard Purdie
2019-05-22 15:39   ` Khem Raj

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.