multilib: Add musl multilib support
PATCH v2 1/1 multilib: Add musl multilib support
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]
---
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(-)
meta/classes/multilib_header.bbclass +9 -7
@@ -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 }
scripts/multilib_header_wrapper.h +1 -1
@@ -5,7 +5,7 @@* */ -#include <bits/wordsize.h> +#include <WORDSIZE_HEADER> #if __WORDSIZE ==32
Signature · 1 line
2.28.0
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.
Quoted 65 lines · Khem Raj
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
__WORDSIZEwhich is defined inbits/reg.hfor musl[YOCTO #13122]
Signed-off-by Khem Raj <[email protected]>---
v2: Use OE's libc switch to include relevant header instead of__GLIBC__definemeta/classes/multilib_header.bbclass | 16 +++++++++------- scripts/multilib_header_wrapper.h | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-)meta/classes/multilib_header.bbclass +9
-7@@ -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 }scripts/multilib_header_wrapper.h +1
-2@@ -5,7 +5,7 @@* */ -#include <bits/wordsize.h> +#include <WORDSIZE_HEADER> #if __WORDSIZE ==32 --2.28.0