blob: 30925ac87d3f02e6f462498ba55857cd016de386 [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"
43 elif targetarch == "powerpc64":
44 dynamic_loader = "${base_libdir}/ld64.so.1"
45 elif targetarch == "x86_64":
46 dynamic_loader = "${base_libdir}/ld-linux-x86-64.so.2"
47 elif re.search("i.86", targetarch):
48 dynamic_loader = "${base_libdir}/ld-linux.so.2"
49 elif targetarch == "arm":
Andrew Geissler82c905d2020-04-13 13:39:40 -050050 dynamic_loader = "${base_libdir}/ld-linux${@['-armhf', ''][d.getVar('TARGET_FPU') == 'soft']}.so.3"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080051 elif targetarch.startswith("aarch64"):
52 dynamic_loader = "${base_libdir}/ld-linux-aarch64${ARMPKGSFX_ENDIAN_64}.so.1"
Brad Bishop08902b02019-08-20 09:16:51 -040053 elif targetarch.startswith("riscv64"):
54 dynamic_loader = "${base_libdir}/ld-linux-riscv64-lp64${@['d', ''][d.getVar('TARGET_FPU') == 'soft']}.so.1"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080055 return dynamic_loader
56
57def get_linuxloader(d):
58 overrides = d.getVar("OVERRIDES").split(":")
59
60 if "libc-baremetal" in overrides:
Andrew Geisslerd1e89492021-02-12 15:35:20 -060061 return "NotSupported"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080062
63 if "libc-musl" in overrides:
64 dynamic_loader = get_musl_loader(d)
65 else:
66 dynamic_loader = get_glibc_loader(d)
67 return dynamic_loader
68
69get_linuxloader[vardepvalue] = "${@get_linuxloader(d)}"
70get_musl_loader[vardepvalue] = "${@get_musl_loader(d)}"
Andrew Geissler82c905d2020-04-13 13:39:40 -050071get_musl_loader_arch[vardepvalue] = "${@get_musl_loader_arch(d)}"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080072get_glibc_loader[vardepvalue] = "${@get_glibc_loader(d)}"