platform: Fix endianness detection for Apple Silicon Macs

Building flashrom on Apple Silicon Macs fails with
"Unable to determine endianness" error. It seems that current
endianness detection fails on macOS due to a combination of
three issues:
1. On macOS, neither GCC nor Clang have __ARMEL__ macros used
by architecture-specific detection;
2. Generic detection fails because Apple uses LITTLE_ENDIAN,
BIG_ENDIAN and BYTE_ORDER macros instead of __BYTE_ORDER and
__LITTLE_ENDIAN;
3. In platform.h, __LITTLE_ENDIAN__ and __BIG_ENDIAN__ macros
are checked only for PowerPC architecture.

This error can be fixed by appending __LITTLE_ENDIAN__ and
__BIG_ENDIAN__ to conditions in IS_ARM branch. I've considered
multiple approaches, but this one seems the cleanest to me.

Signed-off-by: Ivan V <root@pcm720.me>
Change-Id: Ifdb1523ee2c7023e657cfd7b823b091d5deef513
Reviewed-on: https://review.coreboot.org/c/flashrom/+/54964
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Nico Huber <nico.h@gmx.de>
1 file changed
tree: 50636d4d87c778166f1a494cc7ef13fe65b205ae
  1. .gitattributes
  2. .gitignore
  3. 82802ab.c
  4. COPYING
  5. Documentation/
  6. Doxyfile
  7. Makefile
  8. README
  9. amd_imc.c
  10. archtest.c
  11. at45db.c
  12. atahpt.c
  13. atapromise.c
  14. atavia.c
  15. bitbang_spi.c
  16. board_enable.c
  17. buspirate_spi.c
  18. cbtable.c
  19. ch341a_spi.c
  20. chipdrivers.h
  21. chipset_enable.c
  22. cli_classic.c
  23. cli_common.c
  24. cli_output.c
  25. coreboot_tables.h
  26. custom_baud.c
  27. custom_baud.h
  28. dediprog.c
  29. developerbox_spi.c
  30. digilent_spi.c
  31. dmi.c
  32. drkaiser.c
  33. dummyflasher.c
  34. edi.c
  35. edi.h
  36. en29lv640b.c
  37. endiantest.c
  38. ene.h
  39. ene_lpc.c
  40. flash.h
  41. flashchips.c
  42. flashchips.h
  43. flashrom.8.tmpl
  44. flashrom.c
  45. fmap.c
  46. fmap.h
  47. ft2232_spi.c
  48. gfxnvidia.c
  49. helpers.c
  50. hwaccess.c
  51. hwaccess.h
  52. hwaccess_x86_io.h
  53. hwaccess_x86_io_unittest.h
  54. i2c_helper.h
  55. i2c_helper_linux.c
  56. ich_descriptors.c
  57. ich_descriptors.h
  58. ichspi.c
  59. internal.c
  60. it8212.c
  61. it85spi.c
  62. it87spi.c
  63. jedec.c
  64. jlink_spi.c
  65. layout.c
  66. layout.h
  67. libflashrom.c
  68. libflashrom.h
  69. libflashrom.map
  70. linux_mtd.c
  71. linux_spi.c
  72. lspcon_i2c_spi.c
  73. mcp6x_spi.c
  74. mec1308.c
  75. meson.build
  76. meson_options.txt
  77. mstarddc_spi.c
  78. ni845x_spi.c
  79. nic3com.c
  80. nicintel.c
  81. nicintel_eeprom.c
  82. nicintel_spi.c
  83. nicnatsemi.c
  84. nicrealtek.c
  85. ogp_spi.c
  86. opaque.c
  87. os.h
  88. pcidev.c
  89. physmap.c
  90. pickit2_spi.c
  91. platform.h
  92. pony_spi.c
  93. print.c
  94. print_wiki.c
  95. processor_enable.c
  96. programmer.c
  97. programmer.h
  98. raiden_debug_spi.c
  99. rayer_spi.c
  100. realtek_mst_i2c_spi.c
  101. s25f.c
  102. satamv.c
  103. satasii.c
  104. sb600spi.c
  105. serial.c
  106. serprog.c
  107. serprog.h
  108. sfdp.c
  109. spi.c
  110. spi.h
  111. spi25.c
  112. spi25_statusreg.c
  113. spi95.c
  114. sst28sf040.c
  115. sst49lfxxxc.c
  116. sst_fwhub.c
  117. stlinkv3_spi.c
  118. stm50.c
  119. subprojects/
  120. test_build.sh
  121. tests/
  122. udelay.c
  123. unittest_env.h
  124. usb_device.c
  125. usb_device.h
  126. usbblaster_spi.c
  127. usbdev.c
  128. util/
  129. w29ee011.c
  130. w39.c
  131. wbsio_spi.c
  132. writeprotect.c
  133. writeprotect.h