Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 1 | def get_musl_loader_arch(d): |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 2 | import re |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 3 | ldso_arch = "NotSupported" |
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"): |
Andrew Geissler | c3d88e4 | 2020-10-02 09:45:00 -0500 | [diff] [blame] | 7 | ldso_arch = "microblaze${@bb.utils.contains('TUNE_FEATURES', 'bigendian', '', 'el', d)}" |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 8 | elif targetarch.startswith("mips"): |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 9 | ldso_arch = "mips${ABIEXTENSION}${MIPSPKGSFX_BYTE}${MIPSPKGSFX_R6}${MIPSPKGSFX_ENDIAN}${@['', '-sf'][d.getVar('TARGET_FPU') == 'soft']}" |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 10 | elif targetarch == "powerpc": |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 11 | ldso_arch = "powerpc${@['', '-sf'][d.getVar('TARGET_FPU') == 'soft']}" |
Andrew Geissler | 90fd73c | 2021-03-05 15:25:55 -0600 | [diff] [blame] | 12 | elif targetarch.startswith("powerpc64"): |
| 13 | ldso_arch = "powerpc64${@bb.utils.contains('TUNE_FEATURES', 'bigendian', '', 'le', d)}" |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 14 | elif targetarch == "x86_64": |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 15 | ldso_arch = "x86_64" |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 16 | elif re.search("i.86", targetarch): |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 17 | ldso_arch = "i386" |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 18 | elif targetarch.startswith("arm"): |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 19 | ldso_arch = "arm${ARMPKGSFX_ENDIAN}${ARMPKGSFX_EABI}" |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 20 | elif targetarch.startswith("aarch64"): |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 21 | ldso_arch = "aarch64${ARMPKGSFX_ENDIAN_64}" |
Brad Bishop | 08902b0 | 2019-08-20 09:16:51 -0400 | [diff] [blame] | 22 | elif targetarch.startswith("riscv64"): |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 23 | ldso_arch = "riscv64${@['', '-sf'][d.getVar('TARGET_FPU') == 'soft']}" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 24 | elif targetarch.startswith("riscv32"): |
| 25 | ldso_arch = "riscv32${@['', '-sf'][d.getVar('TARGET_FPU') == 'soft']}" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 26 | return ldso_arch |
| 27 | |
| 28 | def get_musl_loader(d): |
| 29 | import re |
| 30 | return "/lib/ld-musl-" + get_musl_loader_arch(d) + ".so.1" |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 31 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 32 | def get_glibc_loader(d): |
| 33 | import re |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 34 | |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 35 | dynamic_loader = "NotSupported" |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 36 | 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 Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 50 | dynamic_loader = "${base_libdir}/ld-linux${@['-armhf', ''][d.getVar('TARGET_FPU') == 'soft']}.so.3" |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 51 | elif targetarch.startswith("aarch64"): |
| 52 | dynamic_loader = "${base_libdir}/ld-linux-aarch64${ARMPKGSFX_ENDIAN_64}.so.1" |
Brad Bishop | 08902b0 | 2019-08-20 09:16:51 -0400 | [diff] [blame] | 53 | elif targetarch.startswith("riscv64"): |
| 54 | 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] | 55 | return dynamic_loader |
| 56 | |
| 57 | def get_linuxloader(d): |
| 58 | overrides = d.getVar("OVERRIDES").split(":") |
| 59 | |
| 60 | if "libc-baremetal" in overrides: |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 61 | return "NotSupported" |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 62 | |
| 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 | |
| 69 | get_linuxloader[vardepvalue] = "${@get_linuxloader(d)}" |
| 70 | get_musl_loader[vardepvalue] = "${@get_musl_loader(d)}" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 71 | get_musl_loader_arch[vardepvalue] = "${@get_musl_loader_arch(d)}" |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 72 | get_glibc_loader[vardepvalue] = "${@get_glibc_loader(d)}" |