[OE-core] [PATCH 1/2] linuxloader: Add get_musl_loader_arch function

Khem Raj raj.khem at gmail.com
Tue Mar 17 07:04:16 UTC 2020


get_musl_loader_arch returns the arch part of ldso for musl, this is
used in get_musl_loader() as well as independently usable, which is
needed for multilib support in musl. Musl stores all ldso in /lib
be it multilib or not, therefore do not use base_libdir instead directly
use /lib

[YOCTO #11971]

Signed-off-by: Khem Raj <raj.khem at gmail.com>
---
 meta/classes/linuxloader.bbclass | 29 +++++++++++++++++------------
 1 file changed, 17 insertions(+), 12 deletions(-)

diff --git a/meta/classes/linuxloader.bbclass b/meta/classes/linuxloader.bbclass
index e2876cec7a..ec0e0556dd 100644
--- a/meta/classes/linuxloader.bbclass
+++ b/meta/classes/linuxloader.bbclass
@@ -1,27 +1,31 @@
-def get_musl_loader(d):
+def get_musl_loader_arch(d):
     import re
-    dynamic_loader = None
+    ldso_arch = None
 
     targetarch = d.getVar("TARGET_ARCH")
     if targetarch.startswith("microblaze"):
-        dynamic_loader = "${base_libdir}/ld-musl-microblaze${@bb.utils.contains('TUNE_FEATURES', 'bigendian', '', 'el' ,d)}.so.1"
+        ldso_arch = "microblaze${@bb.utils.contains('TUNE_FEATURES', 'bigendian', '', 'el' ,d)}"
     elif targetarch.startswith("mips"):
-        dynamic_loader = "${base_libdir}/ld-musl-mips${ABIEXTENSION}${MIPSPKGSFX_BYTE}${MIPSPKGSFX_R6}${MIPSPKGSFX_ENDIAN}${@['', '-sf'][d.getVar('TARGET_FPU') == 'soft']}.so.1"
+        ldso_arch = "mips${ABIEXTENSION}${MIPSPKGSFX_BYTE}${MIPSPKGSFX_R6}${MIPSPKGSFX_ENDIAN}${@['', '-sf'][d.getVar('TARGET_FPU') == 'soft']}"
     elif targetarch == "powerpc":
-        dynamic_loader = "${base_libdir}/ld-musl-powerpc${@['', '-sf'][d.getVar('TARGET_FPU') == 'soft']}.so.1"
+        ldso_arch = "powerpc${@['', '-sf'][d.getVar('TARGET_FPU') == 'soft']}"
     elif targetarch == "powerpc64":
-        dynamic_loader = "${base_libdir}/ld-musl-powerpc64.so.1"
+        ldso_arch = "powerpc64"
     elif targetarch == "x86_64":
-        dynamic_loader = "${base_libdir}/ld-musl-x86_64.so.1"
+        ldso_arch = "x86_64"
     elif re.search("i.86", targetarch):
-        dynamic_loader = "${base_libdir}/ld-musl-i386.so.1"
+        ldso_arch = "i386"
     elif targetarch.startswith("arm"):
-        dynamic_loader = "${base_libdir}/ld-musl-arm${ARMPKGSFX_ENDIAN}${ARMPKGSFX_EABI}.so.1"
+        ldso_arch = "arm${ARMPKGSFX_ENDIAN}${ARMPKGSFX_EABI}"
     elif targetarch.startswith("aarch64"):
-        dynamic_loader = "${base_libdir}/ld-musl-aarch64${ARMPKGSFX_ENDIAN_64}.so.1"
+        ldso_arch = "aarch64${ARMPKGSFX_ENDIAN_64}"
     elif targetarch.startswith("riscv64"):
-        dynamic_loader = "${base_libdir}/ld-musl-riscv64${@['', '-sf'][d.getVar('TARGET_FPU') == 'soft']}.so.1"
-    return dynamic_loader
+        ldso_arch = "riscv64${@['', '-sf'][d.getVar('TARGET_FPU') == 'soft']}"
+    return ldso_arch
+
+def get_musl_loader(d):
+    import re
+    return "/lib/ld-musl-" + get_musl_loader_arch(d) + ".so.1"
 
 def get_glibc_loader(d):
     import re
@@ -62,4 +66,5 @@ def get_linuxloader(d):
 
 get_linuxloader[vardepvalue] = "${@get_linuxloader(d)}"
 get_musl_loader[vardepvalue] = "${@get_musl_loader(d)}"
+get_musl_loader_arch[vardepvalue] = "${@get_musl_loader_arch(d)}"
 get_glibc_loader[vardepvalue] = "${@get_glibc_loader(d)}"
-- 
2.25.1



More information about the Openembedded-core mailing list