blob: c0fbf2683634dda004268f1d718720e9c35412a2 [file] [log] [blame]
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08001def get_musl_loader(d):
2 import re
3 dynamic_loader = None
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"):
7 dynamic_loader = "${base_libdir}/ld-musl-microblaze${@bb.utils.contains('TUNE_FEATURES', 'bigendian', '', 'el' ,d)}.so.1"
8 elif targetarch.startswith("mips"):
9 dynamic_loader = "${base_libdir}/ld-musl-mips${ABIEXTENSION}${MIPSPKGSFX_BYTE}${MIPSPKGSFX_R6}${MIPSPKGSFX_ENDIAN}${@['', '-sf'][d.getVar('TARGET_FPU') == 'soft']}.so.1"
10 elif targetarch == "powerpc":
11 dynamic_loader = "${base_libdir}/ld-musl-powerpc${@['', '-sf'][d.getVar('TARGET_FPU') == 'soft']}.so.1"
12 elif targetarch == "powerpc64":
13 dynamic_loader = "${base_libdir}/ld-musl-powerpc64.so.1"
14 elif targetarch == "x86_64":
15 dynamic_loader = "${base_libdir}/ld-musl-x86_64.so.1"
16 elif re.search("i.86", targetarch):
17 dynamic_loader = "${base_libdir}/ld-musl-i386.so.1"
18 elif targetarch.startswith("arm"):
19 dynamic_loader = "${base_libdir}/ld-musl-arm${ARMPKGSFX_ENDIAN}${ARMPKGSFX_EABI}.so.1"
20 elif targetarch.startswith("aarch64"):
21 dynamic_loader = "${base_libdir}/ld-musl-aarch64${ARMPKGSFX_ENDIAN_64}.so.1"
Brad Bishop08902b02019-08-20 09:16:51 -040022 elif targetarch.startswith("riscv64"):
23 dynamic_loader = "${base_libdir}/ld-musl-riscv64${@['', '-sf'][d.getVar('TARGET_FPU') == 'soft']}.so.1"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080024 return dynamic_loader
Brad Bishopd7bf8c12018-02-25 22:55:05 -050025
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080026def get_glibc_loader(d):
27 import re
Brad Bishopd7bf8c12018-02-25 22:55:05 -050028
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080029 dynamic_loader = None
30 targetarch = d.getVar("TARGET_ARCH")
31 if targetarch in ["powerpc", "microblaze"]:
32 dynamic_loader = "${base_libdir}/ld.so.1"
33 elif targetarch in ["mipsisa32r6el", "mipsisa32r6", "mipsisa64r6el", "mipsisa64r6"]:
34 dynamic_loader = "${base_libdir}/ld-linux-mipsn8.so.1"
35 elif targetarch.startswith("mips"):
36 dynamic_loader = "${base_libdir}/ld.so.1"
37 elif targetarch == "powerpc64":
38 dynamic_loader = "${base_libdir}/ld64.so.1"
39 elif targetarch == "x86_64":
40 dynamic_loader = "${base_libdir}/ld-linux-x86-64.so.2"
41 elif re.search("i.86", targetarch):
42 dynamic_loader = "${base_libdir}/ld-linux.so.2"
43 elif targetarch == "arm":
44 dynamic_loader = "${base_libdir}/ld-linux.so.3"
45 elif targetarch.startswith("aarch64"):
46 dynamic_loader = "${base_libdir}/ld-linux-aarch64${ARMPKGSFX_ENDIAN_64}.so.1"
Brad Bishop08902b02019-08-20 09:16:51 -040047 elif targetarch.startswith("riscv64"):
48 dynamic_loader = "${base_libdir}/ld-linux-riscv64-lp64${@['d', ''][d.getVar('TARGET_FPU') == 'soft']}.so.1"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080049 return dynamic_loader
50
51def get_linuxloader(d):
52 overrides = d.getVar("OVERRIDES").split(":")
53
54 if "libc-baremetal" in overrides:
55 return None
56
57 if "libc-musl" in overrides:
58 dynamic_loader = get_musl_loader(d)
59 else:
60 dynamic_loader = get_glibc_loader(d)
61 return dynamic_loader
62
63get_linuxloader[vardepvalue] = "${@get_linuxloader(d)}"
64get_musl_loader[vardepvalue] = "${@get_musl_loader(d)}"
65get_glibc_loader[vardepvalue] = "${@get_glibc_loader(d)}"