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" |
| 22 | return dynamic_loader |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 23 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 24 | def get_glibc_loader(d): |
| 25 | import re |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 26 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 27 | dynamic_loader = None |
| 28 | targetarch = d.getVar("TARGET_ARCH") |
| 29 | if targetarch in ["powerpc", "microblaze"]: |
| 30 | dynamic_loader = "${base_libdir}/ld.so.1" |
| 31 | elif targetarch in ["mipsisa32r6el", "mipsisa32r6", "mipsisa64r6el", "mipsisa64r6"]: |
| 32 | dynamic_loader = "${base_libdir}/ld-linux-mipsn8.so.1" |
| 33 | elif targetarch.startswith("mips"): |
| 34 | dynamic_loader = "${base_libdir}/ld.so.1" |
| 35 | elif targetarch == "powerpc64": |
| 36 | dynamic_loader = "${base_libdir}/ld64.so.1" |
| 37 | elif targetarch == "x86_64": |
| 38 | dynamic_loader = "${base_libdir}/ld-linux-x86-64.so.2" |
| 39 | elif re.search("i.86", targetarch): |
| 40 | dynamic_loader = "${base_libdir}/ld-linux.so.2" |
| 41 | elif targetarch == "arm": |
| 42 | dynamic_loader = "${base_libdir}/ld-linux.so.3" |
| 43 | elif targetarch.startswith("aarch64"): |
| 44 | dynamic_loader = "${base_libdir}/ld-linux-aarch64${ARMPKGSFX_ENDIAN_64}.so.1" |
| 45 | return dynamic_loader |
| 46 | |
| 47 | def get_linuxloader(d): |
| 48 | overrides = d.getVar("OVERRIDES").split(":") |
| 49 | |
| 50 | if "libc-baremetal" in overrides: |
| 51 | return None |
| 52 | |
| 53 | if "libc-musl" in overrides: |
| 54 | dynamic_loader = get_musl_loader(d) |
| 55 | else: |
| 56 | dynamic_loader = get_glibc_loader(d) |
| 57 | return dynamic_loader |
| 58 | |
| 59 | get_linuxloader[vardepvalue] = "${@get_linuxloader(d)}" |
| 60 | get_musl_loader[vardepvalue] = "${@get_musl_loader(d)}" |
| 61 | get_glibc_loader[vardepvalue] = "${@get_glibc_loader(d)}" |