summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan V <root@pcm720.me>2021-05-27 01:04:38 +0300
committerNico Huber <nico.h@gmx.de>2021-06-06 14:48:56 +0000
commit72af02b60fcedece3191316408b99da90ee96509 (patch)
tree50636d4d87c778166f1a494cc7ef13fe65b205ae
parent21e22ba8a7750f1cfe5cd3323e3137695ffef0a4 (diff)
downloadflashrom-72af02b60fcedece3191316408b99da90ee96509.tar.gz
flashrom-72af02b60fcedece3191316408b99da90ee96509.tar.bz2
flashrom-72af02b60fcedece3191316408b99da90ee96509.zip
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>
-rw-r--r--platform.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/platform.h b/platform.h
index 751957cae..04f1ab1b9 100644
--- a/platform.h
+++ b/platform.h
@@ -116,9 +116,9 @@
#elif IS_ARM
/* ARM can be either endian. */
-#if defined (__ARMEB__)
+#if defined (__ARMEB__) || defined (__BIG_ENDIAN__)
#define __FLASHROM_BIG_ENDIAN__ 1
-#elif defined (__ARMEL__)
+#elif defined (__ARMEL__) || defined (__LITTLE_ENDIAN__)
#define __FLASHROM_LITTLE_ENDIAN__ 1
#endif