Re: [OE-core] [PATCH 3/3] elfutils: Fix eu-* utils builds for musl
On Thu, May 23, 2019 at 06:52:23AM -0700, Khem Raj wrote: > On Wed, May 22, 2019 at 11:10 PM Adrian Bunk 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 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 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
Re: [OE-core] [PATCH 3/3] elfutils: Fix eu-* utils builds for musl
On Wed, May 22, 2019 at 11:10 PM Adrian Bunk 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 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 > > -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
Re: [OE-core] [PATCH 3/3] elfutils: Fix eu-* utils builds for musl
On Wed, May 22, 2019 at 04:29:33PM -0700, Khem Raj wrote: > On Tue, May 21, 2019 at 11:49 PM Adrian Bunk 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 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
Re: [OE-core] [PATCH 3/3] elfutils: Fix eu-* utils builds for musl
On Tue, May 21, 2019 at 11:49 PM Adrian Bunk 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 > -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
Re: [OE-core] [PATCH 3/3] elfutils: Fix eu-* utils builds for musl
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 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH 3/3] elfutils: Fix eu-* utils builds for musl
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 --- .../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..00 --- 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 -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 -