[V2] multilib: Add musl multilib support

Submitted by Khem Raj on Aug. 21, 2020, 8:07 a.m. | Patch ID: 175509

Details

Message ID 20200821080719.1708562-1-raj.khem@gmail.com
State Master Next
Commit 6ba9b84c553f6d5eef5b2c0636252a1b1f5cfcf2
Headers show

Commit Message

Khem Raj Aug. 21, 2020, 8:07 a.m.
Since musl ldso can now co-exist in multilib therefore add support to
build multilibbed headers and adjust the wrapper header to support musl,
it needs __WORDSIZE which is defined in bits/reg.h for musl

[YOCTO #13122]

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
v2: Use OE's libc switch to include relevant header instead of __GLIBC__ define

 meta/classes/multilib_header.bbclass | 16 +++++++++-------
 scripts/multilib_header_wrapper.h    |  2 +-
 2 files changed, 10 insertions(+), 8 deletions(-)

Patch hide | download patch | download mbox

diff --git a/meta/classes/multilib_header.bbclass b/meta/classes/multilib_header.bbclass
index e03f5b13b2..0304f6d3af 100644
--- a/meta/classes/multilib_header.bbclass
+++ b/meta/classes/multilib_header.bbclass
@@ -6,13 +6,14 @@  inherit siteinfo
 # all of the ABI variants for that given architecture.
 #
 oe_multilib_header() {
-
-	case ${HOST_OS} in
-	*-musl*)
-		return
-		;;
-	*)
-	esac
+       case ${HOST_OS} in
+       *-musl*)
+               wordsize="bits/reg.h"
+               ;;
+       *)
+               wordsize="bits/wordsize.h"
+               ;;
+       esac
         # For MIPS: "n32" is a special case, which needs to be
         # distinct from both 64-bit and 32-bit.
         case ${TARGET_ARCH} in
@@ -37,6 +38,7 @@  oe_multilib_header() {
 	   mv ${D}/${includedir}/$each_header ${D}/${includedir}/${stem}-${ident}.h
 
 	   sed -e "s#ENTER_HEADER_FILENAME_HERE#${stem}#g" ${COREBASE}/scripts/multilib_header_wrapper.h > ${D}/${includedir}/$each_header
+	   sed -i -e "s#WORDSIZE_HEADER#${wordsize}#g" ${D}/${includedir}/$each_header
 	done
 }
 
diff --git a/scripts/multilib_header_wrapper.h b/scripts/multilib_header_wrapper.h
index 88f3193812..ae441b4445 100644
--- a/scripts/multilib_header_wrapper.h
+++ b/scripts/multilib_header_wrapper.h
@@ -5,7 +5,7 @@ 
  * 
  */
 
-#include <bits/wordsize.h>
+#include <WORDSIZE_HEADER>
 
 #if __WORDSIZE == 32
 

Comments

Khem Raj Aug. 22, 2020, 5:43 a.m.
I did few world builds and more I realized we should not pursue this
path a few packages started to fail with redefining some defines which
are in bits/reg.h and attleat 5-6 packages showed the issue unlike
glibc where bits/wordsize.h just defined __WORDSIZE on musl
this define is in bits/reg.h but its not the only define. So I feel
that its a wrong fix. Plus I think multilib for musl might be less of
an usecase
practically then say glibc which has some legacy of multilib. Unless
upstream musl separates this out into wordsize.h this would be a wrong
way to fix the multilib. So lets not apply this patch as yet.

On Fri, Aug 21, 2020 at 1:07 AM Khem Raj <raj.khem@gmail.com> wrote:
>
> Since musl ldso can now co-exist in multilib therefore add support to
> build multilibbed headers and adjust the wrapper header to support musl,
> it needs __WORDSIZE which is defined in bits/reg.h for musl
>
> [YOCTO #13122]
>
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> ---
> v2: Use OE's libc switch to include relevant header instead of __GLIBC__ define
>
>  meta/classes/multilib_header.bbclass | 16 +++++++++-------
>  scripts/multilib_header_wrapper.h    |  2 +-
>  2 files changed, 10 insertions(+), 8 deletions(-)
>
> diff --git a/meta/classes/multilib_header.bbclass b/meta/classes/multilib_header.bbclass
> index e03f5b13b2..0304f6d3af 100644
> --- a/meta/classes/multilib_header.bbclass
> +++ b/meta/classes/multilib_header.bbclass
> @@ -6,13 +6,14 @@ inherit siteinfo
>  # all of the ABI variants for that given architecture.
>  #
>  oe_multilib_header() {
> -
> -       case ${HOST_OS} in
> -       *-musl*)
> -               return
> -               ;;
> -       *)
> -       esac
> +       case ${HOST_OS} in
> +       *-musl*)
> +               wordsize="bits/reg.h"
> +               ;;
> +       *)
> +               wordsize="bits/wordsize.h"
> +               ;;
> +       esac
>          # For MIPS: "n32" is a special case, which needs to be
>          # distinct from both 64-bit and 32-bit.
>          case ${TARGET_ARCH} in
> @@ -37,6 +38,7 @@ oe_multilib_header() {
>            mv ${D}/${includedir}/$each_header ${D}/${includedir}/${stem}-${ident}.h
>
>            sed -e "s#ENTER_HEADER_FILENAME_HERE#${stem}#g" ${COREBASE}/scripts/multilib_header_wrapper.h > ${D}/${includedir}/$each_header
> +          sed -i -e "s#WORDSIZE_HEADER#${wordsize}#g" ${D}/${includedir}/$each_header
>         done
>  }
>
> diff --git a/scripts/multilib_header_wrapper.h b/scripts/multilib_header_wrapper.h
> index 88f3193812..ae441b4445 100644
> --- a/scripts/multilib_header_wrapper.h
> +++ b/scripts/multilib_header_wrapper.h
> @@ -5,7 +5,7 @@
>   *
>   */
>
> -#include <bits/wordsize.h>
> +#include <WORDSIZE_HEADER>
>
>  #if __WORDSIZE == 32
>
> --
> 2.28.0
>
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#141703): https://lists.openembedded.org/g/openembedded-core/message/141703
Mute This Topic: https://lists.openembedded.org/mt/76325162/3617530
Group Owner: openembedded-core+owner@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub  [oe-patchwork@oe-patch.openembedded.org]
-=-=-=-=-=-=-=-=-=-=-=-