Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 1 | def get_musl_loader(d): |
| 2 | import re |
| 3 | dynamic_loader = None |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 4 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 5 | 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 Bishop | 08902b0 | 2019-08-20 09:16:51 -0400 | [diff] [blame^] | 22 | elif targetarch.startswith("riscv64"): |
| 23 | dynamic_loader = "${base_libdir}/ld-musl-riscv64${@['', '-sf'][d.getVar('TARGET_FPU') == 'soft']}.so.1" |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 24 | return dynamic_loader |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 25 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 26 | def get_glibc_loader(d): |
| 27 | import re |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 28 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 29 | 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 Bishop | 08902b0 | 2019-08-20 09:16:51 -0400 | [diff] [blame^] | 47 | elif targetarch.startswith("riscv64"): |
| 48 | dynamic_loader = "${base_libdir}/ld-linux-riscv64-lp64${@['d', ''][d.getVar('TARGET_FPU') == 'soft']}.so.1" |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 49 | return dynamic_loader |
| 50 | |
| 51 | def 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 | |
| 63 | get_linuxloader[vardepvalue] = "${@get_linuxloader(d)}" |
| 64 | get_musl_loader[vardepvalue] = "${@get_musl_loader(d)}" |
| 65 | get_glibc_loader[vardepvalue] = "${@get_glibc_loader(d)}" |