elf.py 8.8 KB

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