[systemd-devel] [PATCH] architecture: fix building for big-endian PowerPC with gcc

Michael Olbrich m.olbrich at pengutronix.de
Fri Jul 11 06:04:14 PDT 2014


gcc does not define WORDS_BIGENDIAN for big-endian PowerPC. It defines
__BIG_ENDIAN__ instead. So also check for __BIG_ENDIAN__ to determine if
the system is big-endian.
---
 src/shared/architecture.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/shared/architecture.h b/src/shared/architecture.h
index 4821d5d..ba42761 100644
--- a/src/shared/architecture.h
+++ b/src/shared/architecture.h
@@ -80,7 +80,7 @@ Architecture uname_architecture(void);
 #  define native_architecture() ARCHITECTURE_X86
 #  define LIB_ARCH_TUPLE "i386-linux-gnu"
 #elif defined(__powerpc64__)
-#  if defined(WORDS_BIGENDIAN)
+#  if defined(WORDS_BIGENDIAN) || defined(__BIG_ENDIAN__)
 #    define native_architecture() ARCHITECTURE_PPC64
 #    define LIB_ARCH_TUPLE "ppc64-linux-gnu"
 #  else
@@ -88,7 +88,7 @@ Architecture uname_architecture(void);
 #    error "Missing LIB_ARCH_TUPLE for PPC64LE"
 #  endif
 #elif defined(__powerpc__)
-#  if defined(WORDS_BIGENDIAN)
+#  if defined(WORDS_BIGENDIAN) || defined(__BIG_ENDIAN__)
 #    define native_architecture() ARCHITECTURE_PPC
 #    define LIB_ARCH_TUPLE "powerpc-linux-gnu"
 #  else
-- 
2.0.1



More information about the systemd-devel mailing list