1c342db35SBrad Bishop# 292b42cb3SPatrick Williams# Copyright OpenEmbedded Contributors 392b42cb3SPatrick Williams# 4c342db35SBrad Bishop# SPDX-License-Identifier: GPL-2.0-only 5c342db35SBrad Bishop# 6c342db35SBrad Bishop 71a4b7ee2SBrad Bishopdef machine_dict(d): 8*8460358cSPatrick Williams # Generating this data is slow, so cache it 9*8460358cSPatrick Williams if not hasattr(machine_dict, "machdata"): 10*8460358cSPatrick Williams machine_dict.machdata = { 111a4b7ee2SBrad Bishop # TARGET_OS TARGET_ARCH MACHINE, OSABI, ABIVERSION, Little Endian, 32bit? 121a4b7ee2SBrad Bishop "darwin9" : { 131a4b7ee2SBrad Bishop "arm" : (40, 0, 0, True, 32), 141a4b7ee2SBrad Bishop }, 151a4b7ee2SBrad Bishop "eabi" : { 161a4b7ee2SBrad Bishop "arm" : (40, 0, 0, True, 32), 171a4b7ee2SBrad Bishop }, 181a4b7ee2SBrad Bishop "elf" : { 191a4b7ee2SBrad Bishop "aarch64" : (183, 0, 0, True, 64), 201a4b7ee2SBrad Bishop "aarch64_be" :(183, 0, 0, False, 64), 211a4b7ee2SBrad Bishop "i586" : (3, 0, 0, True, 32), 2282c905dcSAndrew Geissler "i686" : (3, 0, 0, True, 32), 231a4b7ee2SBrad Bishop "x86_64": (62, 0, 0, True, 64), 241a4b7ee2SBrad Bishop "epiphany": (4643, 0, 0, True, 32), 251a4b7ee2SBrad Bishop "lm32": (138, 0, 0, False, 32), 26864cc43bSPatrick Williams "loongarch64":(258, 0, 0, True, 64), 271a4b7ee2SBrad Bishop "mips": ( 8, 0, 0, False, 32), 281a4b7ee2SBrad Bishop "mipsel": ( 8, 0, 0, True, 32), 291a4b7ee2SBrad Bishop "microblaze": (189, 0, 0, False, 32), 301a4b7ee2SBrad Bishop "microblazeel":(189, 0, 0, True, 32), 311a4b7ee2SBrad Bishop "powerpc": (20, 0, 0, False, 32), 321a4b7ee2SBrad Bishop "riscv32": (243, 0, 0, True, 32), 331a4b7ee2SBrad Bishop "riscv64": (243, 0, 0, True, 64), 341a4b7ee2SBrad Bishop }, 351a4b7ee2SBrad Bishop "linux" : { 361a4b7ee2SBrad Bishop "aarch64" : (183, 0, 0, True, 64), 371a4b7ee2SBrad Bishop "aarch64_be" :(183, 0, 0, False, 64), 381a4b7ee2SBrad Bishop "arm" : (40, 97, 0, True, 32), 391a4b7ee2SBrad Bishop "armeb": (40, 97, 0, False, 32), 401a4b7ee2SBrad Bishop "powerpc": (20, 0, 0, False, 32), 411a4b7ee2SBrad Bishop "powerpc64": (21, 0, 0, False, 64), 4282c905dcSAndrew Geissler "powerpc64le": (21, 0, 0, True, 64), 431a4b7ee2SBrad Bishop "i386": ( 3, 0, 0, True, 32), 441a4b7ee2SBrad Bishop "i486": ( 3, 0, 0, True, 32), 451a4b7ee2SBrad Bishop "i586": ( 3, 0, 0, True, 32), 461a4b7ee2SBrad Bishop "i686": ( 3, 0, 0, True, 32), 471a4b7ee2SBrad Bishop "x86_64": (62, 0, 0, True, 64), 481a4b7ee2SBrad Bishop "ia64": (50, 0, 0, True, 64), 491a4b7ee2SBrad Bishop "alpha": (36902, 0, 0, True, 64), 501a4b7ee2SBrad Bishop "hppa": (15, 3, 0, False, 32), 51864cc43bSPatrick Williams "loongarch64":(258, 0, 0, True, 64), 521a4b7ee2SBrad Bishop "m68k": ( 4, 0, 0, False, 32), 531a4b7ee2SBrad Bishop "mips": ( 8, 0, 0, False, 32), 541a4b7ee2SBrad Bishop "mipsel": ( 8, 0, 0, True, 32), 551a4b7ee2SBrad Bishop "mips64": ( 8, 0, 0, False, 64), 561a4b7ee2SBrad Bishop "mips64el": ( 8, 0, 0, True, 64), 571a4b7ee2SBrad Bishop "mipsisa32r6": ( 8, 0, 0, False, 32), 581a4b7ee2SBrad Bishop "mipsisa32r6el": ( 8, 0, 0, True, 32), 591a4b7ee2SBrad Bishop "mipsisa64r6": ( 8, 0, 0, False, 64), 601a4b7ee2SBrad Bishop "mipsisa64r6el": ( 8, 0, 0, True, 64), 611a4b7ee2SBrad Bishop "nios2": (113, 0, 0, True, 32), 621a4b7ee2SBrad Bishop "riscv32": (243, 0, 0, True, 32), 631a4b7ee2SBrad Bishop "riscv64": (243, 0, 0, True, 64), 641a4b7ee2SBrad Bishop "s390": (22, 0, 0, False, 32), 651a4b7ee2SBrad Bishop "sh4": (42, 0, 0, True, 32), 661a4b7ee2SBrad Bishop "sparc": ( 2, 0, 0, False, 32), 671a4b7ee2SBrad Bishop "microblaze": (189, 0, 0, False, 32), 681a4b7ee2SBrad Bishop "microblazeel":(189, 0, 0, True, 32), 691a4b7ee2SBrad Bishop }, 70d159c7fbSAndrew Geissler "linux-android" : { 71d159c7fbSAndrew Geissler "aarch64" : (183, 0, 0, True, 64), 72d159c7fbSAndrew Geissler "i686": ( 3, 0, 0, True, 32), 73d159c7fbSAndrew Geissler "x86_64": (62, 0, 0, True, 64), 74d159c7fbSAndrew Geissler }, 75d159c7fbSAndrew Geissler "linux-androideabi" : { 76d159c7fbSAndrew Geissler "arm" : (40, 97, 0, True, 32), 77d159c7fbSAndrew Geissler }, 781a4b7ee2SBrad Bishop "linux-musl" : { 791a4b7ee2SBrad Bishop "aarch64" : (183, 0, 0, True, 64), 801a4b7ee2SBrad Bishop "aarch64_be" :(183, 0, 0, False, 64), 811a4b7ee2SBrad Bishop "arm" : ( 40, 97, 0, True, 32), 821a4b7ee2SBrad Bishop "armeb": ( 40, 97, 0, False, 32), 831a4b7ee2SBrad Bishop "powerpc": ( 20, 0, 0, False, 32), 8419323693SBrad Bishop "powerpc64": ( 21, 0, 0, False, 64), 8582c905dcSAndrew Geissler "powerpc64le": (21, 0, 0, True, 64), 861a4b7ee2SBrad Bishop "i386": ( 3, 0, 0, True, 32), 871a4b7ee2SBrad Bishop "i486": ( 3, 0, 0, True, 32), 881a4b7ee2SBrad Bishop "i586": ( 3, 0, 0, True, 32), 891a4b7ee2SBrad Bishop "i686": ( 3, 0, 0, True, 32), 901a4b7ee2SBrad Bishop "x86_64": ( 62, 0, 0, True, 64), 911a4b7ee2SBrad Bishop "mips": ( 8, 0, 0, False, 32), 921a4b7ee2SBrad Bishop "mipsel": ( 8, 0, 0, True, 32), 931a4b7ee2SBrad Bishop "mips64": ( 8, 0, 0, False, 64), 941a4b7ee2SBrad Bishop "mips64el": ( 8, 0, 0, True, 64), 951a4b7ee2SBrad Bishop "microblaze": (189, 0, 0, False, 32), 961a4b7ee2SBrad Bishop "microblazeel":(189, 0, 0, True, 32), 971a4b7ee2SBrad Bishop "riscv32": (243, 0, 0, True, 32), 981a4b7ee2SBrad Bishop "riscv64": (243, 0, 0, True, 64), 991a4b7ee2SBrad Bishop "sh4": ( 42, 0, 0, True, 32), 1001a4b7ee2SBrad Bishop }, 1011a4b7ee2SBrad Bishop "uclinux-uclibc" : { 1021a4b7ee2SBrad Bishop "bfin": ( 106, 0, 0, True, 32), 1031a4b7ee2SBrad Bishop }, 1041a4b7ee2SBrad Bishop "linux-gnueabi" : { 1051a4b7ee2SBrad Bishop "arm" : (40, 0, 0, True, 32), 1061a4b7ee2SBrad Bishop "armeb" : (40, 0, 0, False, 32), 1071a4b7ee2SBrad Bishop }, 1081a4b7ee2SBrad Bishop "linux-musleabi" : { 1091a4b7ee2SBrad Bishop "arm" : (40, 0, 0, True, 32), 1101a4b7ee2SBrad Bishop "armeb" : (40, 0, 0, False, 32), 1111a4b7ee2SBrad Bishop }, 1121a4b7ee2SBrad Bishop "linux-gnuspe" : { 1131a4b7ee2SBrad Bishop "powerpc": (20, 0, 0, False, 32), 1141a4b7ee2SBrad Bishop }, 1151a4b7ee2SBrad Bishop "linux-muslspe" : { 1161a4b7ee2SBrad Bishop "powerpc": (20, 0, 0, False, 32), 1171a4b7ee2SBrad Bishop }, 1181a4b7ee2SBrad Bishop "linux-gnu" : { 1191a4b7ee2SBrad Bishop "powerpc": (20, 0, 0, False, 32), 1201a4b7ee2SBrad Bishop "sh4": (42, 0, 0, True, 32), 1211a4b7ee2SBrad Bishop }, 1221a4b7ee2SBrad Bishop "linux-gnu_ilp32" : { 1231a4b7ee2SBrad Bishop "aarch64" : (183, 0, 0, True, 32), 1241a4b7ee2SBrad Bishop }, 1251a4b7ee2SBrad Bishop "linux-gnux32" : { 1261a4b7ee2SBrad Bishop "x86_64": (62, 0, 0, True, 32), 1271a4b7ee2SBrad Bishop }, 1281a4b7ee2SBrad Bishop "linux-muslx32" : { 1291a4b7ee2SBrad Bishop "x86_64": (62, 0, 0, True, 32), 1301a4b7ee2SBrad Bishop }, 1311a4b7ee2SBrad Bishop "linux-gnun32" : { 1321a4b7ee2SBrad Bishop "mips64": ( 8, 0, 0, False, 32), 1331a4b7ee2SBrad Bishop "mips64el": ( 8, 0, 0, True, 32), 1341a4b7ee2SBrad Bishop "mipsisa64r6": ( 8, 0, 0, False, 32), 1351a4b7ee2SBrad Bishop "mipsisa64r6el":( 8, 0, 0, True, 32), 1361a4b7ee2SBrad Bishop }, 1371a4b7ee2SBrad Bishop } 1381a4b7ee2SBrad Bishop 1391a4b7ee2SBrad Bishop # Add in any extra user supplied data which may come from a BSP layer, removing the 1401a4b7ee2SBrad Bishop # need to always change this class directly 1411a4b7ee2SBrad Bishop extra_machdata = (d and d.getVar("PACKAGEQA_EXTRA_MACHDEFFUNCS" or None) or "").split() 1421a4b7ee2SBrad Bishop for m in extra_machdata: 1431a4b7ee2SBrad Bishop call = m + "(machdata, d)" 144*8460358cSPatrick Williams locs = { "machdata" : machine_dict.machdata, "d" : d} 145*8460358cSPatrick Williams machine_dict.machdata = bb.utils.better_eval(call, locs) 1461a4b7ee2SBrad Bishop 147*8460358cSPatrick Williams return machine_dict.machdata 148