blob: 4447c8847c9efb69ba0c87ed02b2ab62ed5d94f1 [file] [log] [blame]
Andrew Geissler82c905d2020-04-13 13:39:40 -05001def get_musl_loader_arch(d):
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08002 import re
Andrew Geisslerd1e89492021-02-12 15:35:20 -06003 ldso_arch = "NotSupported"
Patrick Williamsd8c66bc2016-06-20 12:57:21 -05004
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08005 targetarch = d.getVar("TARGET_ARCH")
6 if targetarch.startswith("microblaze"):
Andrew Geisslerc3d88e42020-10-02 09:45:00 -05007 ldso_arch = "microblaze${@bb.utils.contains('TUNE_FEATURES', 'bigendian', '', 'el', d)}"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08008 elif targetarch.startswith("mips"):
Andrew Geissler82c905d2020-04-13 13:39:40 -05009 ldso_arch = "mips${ABIEXTENSION}${MIPSPKGSFX_BYTE}${MIPSPKGSFX_R6}${MIPSPKGSFX_ENDIAN}${@['', '-sf'][d.getVar('TARGET_FPU') == 'soft']}"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080010 elif targetarch == "powerpc":
Andrew Geissler82c905d2020-04-13 13:39:40 -050011 ldso_arch = "powerpc${@['', '-sf'][d.getVar('TARGET_FPU') == 'soft']}"
Andrew Geissler90fd73c2021-03-05 15:25:55 -060012 elif targetarch.startswith("powerpc64"):
13 ldso_arch = "powerpc64${@bb.utils.contains('TUNE_FEATURES', 'bigendian', '', 'le', d)}"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080014 elif targetarch == "x86_64":
Andrew Geissler82c905d2020-04-13 13:39:40 -050015 ldso_arch = "x86_64"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080016 elif re.search("i.86", targetarch):
Andrew Geissler82c905d2020-04-13 13:39:40 -050017 ldso_arch = "i386"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080018 elif targetarch.startswith("arm"):
Andrew Geissler82c905d2020-04-13 13:39:40 -050019 ldso_arch = "arm${ARMPKGSFX_ENDIAN}${ARMPKGSFX_EABI}"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080020 elif targetarch.startswith("aarch64"):
Andrew Geissler82c905d2020-04-13 13:39:40 -050021 ldso_arch = "aarch64${ARMPKGSFX_ENDIAN_64}"
Brad Bishop08902b02019-08-20 09:16:51 -040022 elif targetarch.startswith("riscv64"):
Andrew Geissler82c905d2020-04-13 13:39:40 -050023 ldso_arch = "riscv64${@['', '-sf'][d.getVar('TARGET_FPU') == 'soft']}"
Andrew Geisslerc9f78652020-09-18 14:11:35 -050024 elif targetarch.startswith("riscv32"):
25 ldso_arch = "riscv32${@['', '-sf'][d.getVar('TARGET_FPU') == 'soft']}"
Andrew Geissler82c905d2020-04-13 13:39:40 -050026 return ldso_arch
27
28def get_musl_loader(d):
29 import re
30 return "/lib/ld-musl-" + get_musl_loader_arch(d) + ".so.1"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050031
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080032def get_glibc_loader(d):
33 import re
Brad Bishopd7bf8c12018-02-25 22:55:05 -050034
Andrew Geisslerd1e89492021-02-12 15:35:20 -060035 dynamic_loader = "NotSupported"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080036 targetarch = d.getVar("TARGET_ARCH")
37 if targetarch in ["powerpc", "microblaze"]:
38 dynamic_loader = "${base_libdir}/ld.so.1"
39 elif targetarch in ["mipsisa32r6el", "mipsisa32r6", "mipsisa64r6el", "mipsisa64r6"]:
40 dynamic_loader = "${base_libdir}/ld-linux-mipsn8.so.1"
41 elif targetarch.startswith("mips"):
42 dynamic_loader = "${base_libdir}/ld.so.1"
Andrew Geissler09036742021-06-25 14:25:14 -050043 elif targetarch == "powerpc64le":
44 dynamic_loader = "${base_libdir}/ld64.so.2"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080045 elif targetarch == "powerpc64":
46 dynamic_loader = "${base_libdir}/ld64.so.1"
47 elif targetarch == "x86_64":
48 dynamic_loader = "${base_libdir}/ld-linux-x86-64.so.2"
49 elif re.search("i.86", targetarch):
50 dynamic_loader = "${base_libdir}/ld-linux.so.2"
51 elif targetarch == "arm":
Andrew Geissler82c905d2020-04-13 13:39:40 -050052 dynamic_loader = "${base_libdir}/ld-linux${@['-armhf', ''][d.getVar('TARGET_FPU') == 'soft']}.so.3"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080053 elif targetarch.startswith("aarch64"):
54 dynamic_loader = "${base_libdir}/ld-linux-aarch64${ARMPKGSFX_ENDIAN_64}.so.1"
Brad Bishop08902b02019-08-20 09:16:51 -040055 elif targetarch.startswith("riscv64"):
56 dynamic_loader = "${base_libdir}/ld-linux-riscv64-lp64${@['d', ''][d.getVar('TARGET_FPU') == 'soft']}.so.1"
Andrew Geissler09036742021-06-25 14:25:14 -050057 elif targetarch.startswith("riscv32"):
58 dynamic_loader = "${base_libdir}/ld-linux-riscv32-ilp32${@['d', ''][d.getVar('TARGET_FPU') == 'soft']}.so.1"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080059 return dynamic_loader
60
61def get_linuxloader(d):
62 overrides = d.getVar("OVERRIDES").split(":")
63
64 if "libc-baremetal" in overrides:
Andrew Geisslerd1e89492021-02-12 15:35:20 -060065 return "NotSupported"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080066
67 if "libc-musl" in overrides:
68 dynamic_loader = get_musl_loader(d)
69 else:
70 dynamic_loader = get_glibc_loader(d)
71 return dynamic_loader
72
73get_linuxloader[vardepvalue] = "${@get_linuxloader(d)}"
74get_musl_loader[vardepvalue] = "${@get_musl_loader(d)}"
Andrew Geissler82c905d2020-04-13 13:39:40 -050075get_musl_loader_arch[vardepvalue] = "${@get_musl_loader_arch(d)}"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080076get_glibc_loader[vardepvalue] = "${@get_glibc_loader(d)}"