Skip to contentSkip to conversation

ppc/musl: Improve support

PATCH In review Serhey Popovych 2 participants 9 messages Jan 12, 2019

lore
Share & tools
lore
#0 lore raw

cover ppc/musl: Improve support

This is followup set of improvements for recently merged musl on PowerPC fixes. It fixes more issues discovered later after first series merged.

See individual commit message for details on each change presented.

Build tested following images with musl as libc:

core-image-sato-dev
core-image-full-cmdline

Boot tested using KVM-HV on IBM POWER8 and HVM-PR on old Power Mac G5.

Serhey Popovych (4):
systemd: Correctly check ENABLE_GSHADOW with if/endif
systemd: Use arch overrides instead of machine
mpfr: Disable float128 when building with musl as libc
valgrind: Mark powerpc64 with musl as incompatible

 ...user-util-properly-protect-use-of-gshadow.patch | 38 ++++++++++++++++++++++
 ...clude-gshadow-only-if-ENABLE_GSHADOW-is-1.patch | 29 -----------------
 ...se-if-instead-of-ifdef-for-ENABLE_GSHADOW.patch | 28 ++++++++++++++++
 meta/recipes-core/systemd/systemd_239.bb           |  9 ++---
 meta/recipes-devtools/valgrind/valgrind_3.14.0.bb  |  3 ++
 meta/recipes-support/mpfr/mpfr_4.0.1.bb            |  2 ++
 6 files changed, 76 insertions(+), 33 deletions(-)
 create mode 100644 meta/recipes-core/systemd/systemd/0005-basic-user-util-properly-protect-use-of-gshadow.patch
 delete mode 100644 meta/recipes-core/systemd/systemd/0005-include-gshadow-only-if-ENABLE_GSHADOW-is-1.patch
 create mode 100644 meta/recipes-core/systemd/systemd/0022-Use-if-instead-of-ifdef-for-ENABLE_GSHADOW.patch
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/4 systemd: Correctly check ENABLE_GSHADOW with if/endif

Use commit 4f07ffa8f5ab ("Use #if instead of #ifdef for ENABLE_GSHADOW") from upstream to check ENABLE_GSHADOW correctly that is defined as 0 in case of musl.

While there replace specific patch with one from upstream that does exactly the same commit 66a5b5ce9b99 ("basic/user-util: properly protect use of gshadow").

---
 ...user-util-properly-protect-use-of-gshadow.patch | 38 ++++++++++++++++++++++
 ...clude-gshadow-only-if-ENABLE_GSHADOW-is-1.patch | 29 -----------------
 ...se-if-instead-of-ifdef-for-ENABLE_GSHADOW.patch | 28 ++++++++++++++++
 meta/recipes-core/systemd/systemd_239.bb           |  3 +-
 4 files changed, 68 insertions(+), 30 deletions(-)
 create mode 100644 meta/recipes-core/systemd/systemd/0005-basic-user-util-properly-protect-use-of-gshadow.patch
 delete mode 100644 meta/recipes-core/systemd/systemd/0005-include-gshadow-only-if-ENABLE_GSHADOW-is-1.patch
 create mode 100644 meta/recipes-core/systemd/systemd/0022-Use-if-instead-of-ifdef-for-ENABLE_GSHADOW.patch
meta/recipes-core/systemd/systemd/0005-basic-user-util-properly-protect-use-of-gshadow.patch new file +38 -0
new file mode 100644
index 0000000..518c05b
@@ -0,0 +1,38 @@
+From 66a5b5ce9b991327d594f7b635de16999ca54093 Mon Sep 17 00:00:00 2001
+From: "Yann E. MORIN" <[email protected]>
+Date: Wed, 21 Nov 2018 18:09:04 +0100
+Subject: basic/user-util: properly protect use of gshadow
+
+Commit 100d5f6ee6 (user-util: add new wrappers for [...] database
+files), ammended by commit 4f07ffa8f5 (Use #if instead of #ifdef for
+ENABLE_GSHADOW) moved code from sysuser to basic/user-util.
+
+In doing so, the combination of both commits properly propagated the
+ENABLE_GSHADOW conditions around the function manipulating gshadow, but
+they forgot to protect the inclusion of the gshadow.h header.
+
+Fix that to be able to build on C libraries that do not provide gshadow
+(e.g. uClibc-ng, where it does not exist.)
+
+Upstream-Status: Backport [https://github.com/systemd/systemd/commit/66a5b5ce9b991327d594f7b635de16999ca54093]
+---
+ src/basic/user-util.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/basic/user-util.h b/src/basic/user-util.h
+index b6de0e423..cc899ee76 100644
+--- a/src/basic/user-util.h
++++ b/src/basic/user-util.h
+@@ -2,7 +2,9 @@
+ #pragma once
+ 
+ #include <grp.h>
++#if ENABLE_GSHADOW
+ #include <gshadow.h>
++#endif
+ #include <pwd.h>
+ #include <shadow.h>
+ #include <stdbool.h>
+-- 
+2.18.1
+
meta/recipes-core/systemd/systemd/0005-include-gshadow-only-if-ENABLE_GSHADOW-is-1.patch deleted +0 -29
deleted file mode 100644
index 6d5faf5..0000000
@@ -1,29 +0,0 @@
-From a2c4d46944892174930135672508389a04e191f0 Mon Sep 17 00:00:00 2001
-From: Chen Qi <[email protected]>
-Date: Fri, 29 Jun 2018 13:53:29 +0800
-Subject: [PATCH 05/19] include gshadow only if ENABLE_GSHADOW is 1
-
-Upstream-Status: Inappropriate [musl]
-
-Signed-off-by: Chen Qi <[email protected]>
----
- src/basic/user-util.h | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/src/basic/user-util.h b/src/basic/user-util.h
-index b74f16885..f9c1e29c4 100644
---- a/src/basic/user-util.h
-+++ b/src/basic/user-util.h
-@@ -2,7 +2,9 @@
- #pragma once
- 
- #include <grp.h>
-+#if ENABLE_GSHADOW
- #include <gshadow.h>
-+#endif
- #include <pwd.h>
- #include <shadow.h>
- #include <stdbool.h>
--- 
-2.11.0
-
meta/recipes-core/systemd/systemd/0022-Use-if-instead-of-ifdef-for-ENABLE_GSHADOW.patch new file +28 -0
new file mode 100644
index 0000000..a9c1c9c
@@ -0,0 +1,28 @@
+From 4f07ffa8f5ab85011422bb7114f1cddf49d4923d Mon Sep 17 00:00:00 2001
+From: ChenQi1989 <[email protected]>
+Date: Fri, 29 Jun 2018 06:54:07 +0000
+Subject: Use #if instead of #ifdef for ENABLE_GSHADOW
+
+ENABLE_GSHADOW is defined to be 0 or 1. So #if should be used instead of #ifdef.
+
+Upstream-Status: Backport [https://github.com/systemd/systemd/commit/4f07ffa8f5ab85011422bb7114f1cddf49d4923d]
+---
+ src/basic/user-util.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/basic/user-util.h b/src/basic/user-util.h
+index b74f16885..b2f198c89 100644
+--- a/src/basic/user-util.h
++++ b/src/basic/user-util.h
+@@ -102,7 +102,7 @@ int fgetgrent_sane(FILE *stream, struct group **gr);
+ int putpwent_sane(const struct passwd *pw, FILE *stream);
+ int putspent_sane(const struct spwd *sp, FILE *stream);
+ int putgrent_sane(const struct group *gr, FILE *stream);
+-#ifdef ENABLE_GSHADOW
++#if ENABLE_GSHADOW
+ int fgetsgent_sane(FILE *stream, struct sgrp **sg);
+ int putsgent_sane(const struct sgrp *sg, FILE *stream);
+ #endif
+-- 
+2.18.1
+
meta/recipes-core/systemd/systemd_239.bb +2 -1
index be836ff..0f1fa27 100644
@@ -46,7 +46,7 @@ SRC_URI_MUSL = "file://0001-Use-getenv-when-secure-versions-are-not-available.pa
                file://0002-don-t-use-glibc-specific-qsort_r.patch \
                file://0003-comparison_fn_t-is-glibc-specific-use-raw-signature-.patch \
                file://0004-add-fallback-parse_printf_format-implementation.patch \
-               file://0005-include-gshadow-only-if-ENABLE_GSHADOW-is-1.patch \
+               file://0005-basic-user-util-properly-protect-use-of-gshadow.patch \
                file://0006-src-basic-missing.h-check-for-missing-strndupa.patch \
                file://0007-Include-netinet-if_ether.h.patch \
                file://0008-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch \
@@ -63,6 +63,7 @@ SRC_URI_MUSL = "file://0001-Use-getenv-when-secure-versions-are-not-available.pa
                file://0019-Do-not-disable-buffering-when-writing-to-oom_score_a.patch \
                file://0020-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch \
                file://0021-Hide-__start_BUS_ERROR_MAP-and-__stop_BUS_ERROR_MAP.patch \
+               file://0022-Use-if-instead-of-ifdef-for-ENABLE_GSHADOW.patch \
                "
 
 # Workaround undefined reference to `__stack_chk_fail_local' on qemux86 and qemuppc for musl
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/4 systemd: Use arch overrides instead of machine

In reply to Serhey Popovych

With custom BSP and build with musl we still affected by undefined reference to stack-protector specific functions.

Use arch overrides instead of machine to ensure fix applied to entire architecture instead of custom machine like qemux86 and qemuppc.

---
 meta/recipes-core/systemd/systemd_239.bb | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
meta/recipes-core/systemd/systemd_239.bb +3 -3
index 0f1fa27..2e11d71 100644
@@ -66,9 +66,9 @@ SRC_URI_MUSL = "file://0001-Use-getenv-when-secure-versions-are-not-available.pa
                file://0022-Use-if-instead-of-ifdef-for-ENABLE_GSHADOW.patch \
                "
 
-# Workaround undefined reference to `__stack_chk_fail_local' on qemux86 and qemuppc for musl
-SRC_URI_append_libc-musl_qemux86 = " file://0001-Remove-fstack-protector-flags-to-workaround-musl-bui.patch"
-SRC_URI_append_libc-musl_qemuppc = " file://0001-Remove-fstack-protector-flags-to-workaround-musl-bui.patch"
+# Workaround undefined reference to `__stack_chk_fail_local' on x86 and powerpc for musl
+SRC_URI_append_libc-musl_x86 = " file://0001-Remove-fstack-protector-flags-to-workaround-musl-bui.patch"
+SRC_URI_append_libc-musl_powerpc = " file://0001-Remove-fstack-protector-flags-to-workaround-musl-bui.patch"
 
 PAM_PLUGINS = " \
     pam-plugin-unix \
Signature · 1 line
2.7.4
#3 lore raw

Re: [PATCH 2/4] systemd: Use arch overrides instead of machine

Quoted 17 lines · Serhey Popovych

With custom BSP and build with musl we still affected by undefined reference to stack-protector specific functions.

Use arch overrides instead of machine to ensure fix applied to entire architecture instead of custom machine like qemux86 and qemuppc.

---
 meta/recipes-core/systemd/systemd_239.bb | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
meta/recipes-core/systemd/systemd_239.bb +0 -0
index 0f1fa27..2e11d71 100644

meta/recipes-core/systemd/systemd_239.bb SRC_URI_MUSL = "file://0001-Use-getenv-when-secure-versions-are-not-available.pa · line 71

Quoted 9 lines
meta/recipes-core/systemd/systemd_239.bb +3 -3
@@ -66,9 +66,9 @@ SRC_URI_MUSL = "file://0001-Use-getenv-when-secure-versions-are-not-available.pa
                file://0022-Use-if-instead-of-ifdef-for-ENABLE_GSHADOW.patch \
                "
 
-# Workaround undefined reference to `__stack_chk_fail_local' on qemux86 and qemuppc for musl
-SRC_URI_append_libc-musl_qemux86 = " file://0001-Remove-fstack-protector-flags-to-workaround-musl-bui.patch"
-SRC_URI_append_libc-musl_qemuppc = " file://0001-Remove-fstack-protector-flags-to-workaround-musl-bui.patch"
+# Workaround undefined reference to `__stack_chk_fail_local' on x86 and powerpc for musl
+SRC_URI_append_libc-musl_x86 = " file://0001-Remove-fstack-protector-flags-to-workaround-musl-bui.patch"
+SRC_URI_append_libc-musl_powerpc = " file://0001-Remove-fstack-protector-flags-to-workaround-musl-bui.patch"

this seems wrong to me. While you are here, can we try to link with -lssp-nonshared instead ?

Quoted 11 lines
meta/recipes-core/systemd/systemd_239.bb +0 -1
 PAM_PLUGINS = " \
     pam-plugin-unix \
--

2.7.4

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

#4 lore raw

PATCH 3/4 mpfr: Disable float128 when building with musl as libc

In reply to Serhey Popovych

Since it does not support float128 type.

---
 meta/recipes-support/mpfr/mpfr_4.0.1.bb | 2 ++
 1 file changed, 2 insertions(+)
meta/recipes-support/mpfr/mpfr_4.0.1.bb +2 -0
index 2eee76a..ccf7fdc 100644
@@ -16,4 +16,6 @@ SRC_URI[sha256sum] = "67874a60826303ee2fb6affc6dc0ddd3e749e9bfcb4c8655e3953d0458
 
 UPSTREAM_CHECK_URI = "http://www.mpfr.org/mpfr-current/"
 
+EXTRA_OECONF_append_libc-musl = " --disable-float128"
+
 BBCLASSEXTEND = "native nativesdk"
Signature · 1 line
2.7.4
#5 lore raw

PATCH 4/4 valgrind: Mark powerpc64 with musl as incompatible

In reply to Serhey Popovych

Building musl for powerpc64 enforces elfv2 ABI since commit 68c964185519 ("arch-powerpc64.inc: Use elfv2 ABI when building with musl") that is not compatible with valgrind.

---
 meta/recipes-devtools/valgrind/valgrind_3.14.0.bb | 3 +++
 1 file changed, 3 insertions(+)
meta/recipes-devtools/valgrind/valgrind_3.14.0.bb +3 -0
index 4d15a50..d882319 100644
@@ -58,6 +58,9 @@ COMPATIBLE_HOST_linux-muslx32 = 'null'
 COMPATIBLE_HOST_mipsarchr6 = 'null'
 COMPATIBLE_HOST_linux-gnun32 = 'null'
 
+# Disable for powerpc64 with musl
+COMPATIBLE_HOST_libc-musl_powerpc64 = 'null'
+
 inherit autotools ptest multilib_header
 
 EXTRA_OECONF = "--enable-tls --without-mpicc"
Signature · 1 line
2.7.4
#6 lore raw

Re: [PATCH 4/4] valgrind: Mark powerpc64 with musl as incompatible

Quoted 15 lines · Serhey Popovych

Building musl for powerpc64 enforces elfv2 ABI since commit 68c964185519 ("arch-powerpc64.inc: Use elfv2 ABI when building with musl") that is not compatible with valgrind.

---
 meta/recipes-devtools/valgrind/valgrind_3.14.0.bb | 3 +++
 1 file changed, 3 insertions(+)
meta/recipes-devtools/valgrind/valgrind_3.14.0.bb +0 -0
index 4d15a50..d882319 100644

meta/recipes-devtools/valgrind/valgrind_3.14.0.bb COMPATIBLE_HOST_linux-muslx32 = 'null' · line 62

Quoted 5 lines
meta/recipes-devtools/valgrind/valgrind_3.14.0.bb +2 -0
@@ -58,6 +58,9 @@ COMPATIBLE_HOST_linux-muslx32 = 'null'
 COMPATIBLE_HOST_mipsarchr6 = 'null'
 COMPATIBLE_HOST_linux-gnun32 = 'null'
 
+# Disable for powerpc64 with musl
+COMPATIBLE_HOST_libc-musl_powerpc64 = 'null'

lets do it for powerpc64el too

Quoted 12 lines
meta/recipes-devtools/valgrind/valgrind_3.14.0.bb +1 -1
+
 inherit autotools ptest multilib_header
 
 EXTRA_OECONF = "--enable-tls --without-mpicc"
--

2.7.4

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

#7 lore raw

Re: [PATCH 4/4] valgrind: Mark powerpc64 with musl as incompatible

Quoted 20 lines · Khem Raj
Quoted 18 lines · Serhey Popovych

Building musl for powerpc64 enforces elfv2 ABI since commit 68c964185519 ("arch-powerpc64.inc: Use elfv2 ABI when building with musl") that is not compatible with valgrind.

---
 meta/recipes-devtools/valgrind/valgrind_3.14.0.bb | 3 +++
 1 file changed, 3 insertions(+)
meta/recipes-devtools/valgrind/valgrind_3.14.0.bb +0 -0
index 4d15a50..d882319 100644
@@ -58,6 +58,9 @@ COMPATIBLE_HOST_linux-muslx32 = 'null'
 COMPATIBLE_HOST_mipsarchr6 = 'null'
 COMPATIBLE_HOST_linux-gnun32 = 'null'
 
Quoted 4 lines

meta/recipes-devtools/valgrind/valgrind_3.14.0.bb COMPATIBLE_HOST_linux-muslx32 = 'null' · line 62

Quoted 2 lines
meta/recipes-devtools/valgrind/valgrind_3.14.0.bb +2 -0
+# Disable for powerpc64 with musl
+COMPATIBLE_HOST_libc-musl_powerpc64 = 'null'

lets do it for powerpc64el too

I guess powerpc64le is GNU standard target, not *el.

Support for powerpc64le is missing in OE. Before it is added I'd prefer not to do this for powerpc64le.

Quoted 12 lines
Quoted 12 lines
meta/recipes-devtools/valgrind/valgrind_3.14.0.bb +1 -1
+
 inherit autotools ptest multilib_header
 
 EXTRA_OECONF = "--enable-tls --without-mpicc"
--

2.7.4

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

#8 lore raw

Re: [PATCH 4/4] valgrind: Mark powerpc64 with musl as incompatible

Quoted 27 lines · Serhey Popovych
Quoted 20 lines · Khem Raj
Quoted 18 lines · Serhey Popovych

Building musl for powerpc64 enforces elfv2 ABI since commit 68c964185519 ("arch-powerpc64.inc: Use elfv2 ABI when building with musl") that is not compatible with valgrind.

---
 meta/recipes-devtools/valgrind/valgrind_3.14.0.bb | 3 +++
 1 file changed, 3 insertions(+)
meta/recipes-devtools/valgrind/valgrind_3.14.0.bb +0 -0
index 4d15a50..d882319 100644
@@ -58,6 +58,9 @@ COMPATIBLE_HOST_linux-muslx32 = 'null'
 COMPATIBLE_HOST_mipsarchr6 = 'null'
 COMPATIBLE_HOST_linux-gnun32 = 'null'
 
Quoted 4 lines

meta/recipes-devtools/valgrind/valgrind_3.14.0.bb COMPATIBLE_HOST_linux-muslx32 = 'null' · line 62

Quoted 2 lines
meta/recipes-devtools/valgrind/valgrind_3.14.0.bb +2 -0
+# Disable for powerpc64 with musl
+COMPATIBLE_HOST_libc-musl_powerpc64 = 'null'

lets do it for powerpc64el too

Quoted 4 lines

I guess powerpc64le is GNU standard target, not *el.

Support for powerpc64le is missing in OE. Before it is added I'd prefer not to do this for powerpc64le.

IIRC there were some posts for EL in past, but OK lets not do it here

Quoted 17 lines
Quoted 13 lines
Quoted 13 lines
meta/recipes-devtools/valgrind/valgrind_3.14.0.bb +1 -1
+
 inherit autotools ptest multilib_header
 
 EXTRA_OECONF = "--enable-tls --without-mpicc"
--

2.7.4

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core