elf.py 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. #
  2. # SPDX-License-Identifier: GPL-2.0-only
  3. #
  4. def machine_dict(d):
  5. # TARGET_OS TARGET_ARCH MACHINE, OSABI, ABIVERSION, Little Endian, 32bit?
  6. machdata = {
  7. "darwin9" : {
  8. "arm" : (40, 0, 0, True, 32),
  9. },
  10. "eabi" : {
  11. "arm" : (40, 0, 0, True, 32),
  12. },
  13. "elf" : {
  14. "aarch64" : (183, 0, 0, True, 64),
  15. "aarch64_be" :(183, 0, 0, False, 64),
  16. "i586" : (3, 0, 0, True, 32),
  17. "x86_64": (62, 0, 0, True, 64),
  18. "epiphany": (4643, 0, 0, True, 32),
  19. "lm32": (138, 0, 0, False, 32),
  20. "mips": ( 8, 0, 0, False, 32),
  21. "mipsel": ( 8, 0, 0, True, 32),
  22. "microblaze": (189, 0, 0, False, 32),
  23. "microblazeeb":(189, 0, 0, False, 32),
  24. "microblazeel":(189, 0, 0, True, 32),
  25. "powerpc": (20, 0, 0, False, 32),
  26. "riscv32": (243, 0, 0, True, 32),
  27. "riscv64": (243, 0, 0, True, 64),
  28. },
  29. "linux" : {
  30. "aarch64" : (183, 0, 0, True, 64),
  31. "aarch64_be" :(183, 0, 0, False, 64),
  32. "arm" : (40, 97, 0, True, 32),
  33. "armeb": (40, 97, 0, False, 32),
  34. "powerpc": (20, 0, 0, False, 32),
  35. "powerpc64": (21, 0, 0, False, 64),
  36. "i386": ( 3, 0, 0, True, 32),
  37. "i486": ( 3, 0, 0, True, 32),
  38. "i586": ( 3, 0, 0, True, 32),
  39. "i686": ( 3, 0, 0, True, 32),
  40. "x86_64": (62, 0, 0, True, 64),
  41. "ia64": (50, 0, 0, True, 64),
  42. "alpha": (36902, 0, 0, True, 64),
  43. "hppa": (15, 3, 0, False, 32),
  44. "m68k": ( 4, 0, 0, False, 32),
  45. "mips": ( 8, 0, 0, False, 32),
  46. "mipsel": ( 8, 0, 0, True, 32),
  47. "mips64": ( 8, 0, 0, False, 64),
  48. "mips64el": ( 8, 0, 0, True, 64),
  49. "mipsisa32r6": ( 8, 0, 0, False, 32),
  50. "mipsisa32r6el": ( 8, 0, 0, True, 32),
  51. "mipsisa64r6": ( 8, 0, 0, False, 64),
  52. "mipsisa64r6el": ( 8, 0, 0, True, 64),
  53. "nios2": (113, 0, 0, True, 32),
  54. "riscv32": (243, 0, 0, True, 32),
  55. "riscv64": (243, 0, 0, True, 64),
  56. "s390": (22, 0, 0, False, 32),
  57. "sh4": (42, 0, 0, True, 32),
  58. "sparc": ( 2, 0, 0, False, 32),
  59. "microblaze": (189, 0, 0, False, 32),
  60. "microblazeeb":(189, 0, 0, False, 32),
  61. "microblazeel":(189, 0, 0, True, 32),
  62. },
  63. "linux-musl" : {
  64. "aarch64" : (183, 0, 0, True, 64),
  65. "aarch64_be" :(183, 0, 0, False, 64),
  66. "arm" : ( 40, 97, 0, True, 32),
  67. "armeb": ( 40, 97, 0, False, 32),
  68. "powerpc": ( 20, 0, 0, False, 32),
  69. "powerpc64": ( 21, 0, 0, False, 64),
  70. "i386": ( 3, 0, 0, True, 32),
  71. "i486": ( 3, 0, 0, True, 32),
  72. "i586": ( 3, 0, 0, True, 32),
  73. "i686": ( 3, 0, 0, True, 32),
  74. "x86_64": ( 62, 0, 0, True, 64),
  75. "mips": ( 8, 0, 0, False, 32),
  76. "mipsel": ( 8, 0, 0, True, 32),
  77. "mips64": ( 8, 0, 0, False, 64),
  78. "mips64el": ( 8, 0, 0, True, 64),
  79. "microblaze": (189, 0, 0, False, 32),
  80. "microblazeeb":(189, 0, 0, False, 32),
  81. "microblazeel":(189, 0, 0, True, 32),
  82. "riscv32": (243, 0, 0, True, 32),
  83. "riscv64": (243, 0, 0, True, 64),
  84. "sh4": ( 42, 0, 0, True, 32),
  85. },
  86. "uclinux-uclibc" : {
  87. "bfin": ( 106, 0, 0, True, 32),
  88. },
  89. "linux-gnueabi" : {
  90. "arm" : (40, 0, 0, True, 32),
  91. "armeb" : (40, 0, 0, False, 32),
  92. },
  93. "linux-musleabi" : {
  94. "arm" : (40, 0, 0, True, 32),
  95. "armeb" : (40, 0, 0, False, 32),
  96. },
  97. "linux-gnuspe" : {
  98. "powerpc": (20, 0, 0, False, 32),
  99. },
  100. "linux-muslspe" : {
  101. "powerpc": (20, 0, 0, False, 32),
  102. },
  103. "linux-gnu" : {
  104. "powerpc": (20, 0, 0, False, 32),
  105. "sh4": (42, 0, 0, True, 32),
  106. },
  107. "linux-gnu_ilp32" : {
  108. "aarch64" : (183, 0, 0, True, 32),
  109. },
  110. "linux-gnux32" : {
  111. "x86_64": (62, 0, 0, True, 32),
  112. },
  113. "linux-muslx32" : {
  114. "x86_64": (62, 0, 0, True, 32),
  115. },
  116. "linux-gnun32" : {
  117. "mips64": ( 8, 0, 0, False, 32),
  118. "mips64el": ( 8, 0, 0, True, 32),
  119. "mipsisa64r6": ( 8, 0, 0, False, 32),
  120. "mipsisa64r6el":( 8, 0, 0, True, 32),
  121. },
  122. }
  123. # Add in any extra user supplied data which may come from a BSP layer, removing the
  124. # need to always change this class directly
  125. extra_machdata = (d and d.getVar("PACKAGEQA_EXTRA_MACHDEFFUNCS" or None) or "").split()
  126. for m in extra_machdata:
  127. call = m + "(machdata, d)"
  128. locs = { "machdata" : machdata, "d" : d}
  129. machdata = bb.utils.better_eval(call, locs)
  130. return machdata