Browse Source

PPC: Fix cross-endian builds.

Mike Pall 10 years ago
parent
commit
dec4acca9a
2 changed files with 7 additions and 0 deletions
  1. 5 0
      src/Makefile
  2. 2 0
      src/lj_arch.h

+ 5 - 0
src/Makefile

@@ -221,6 +221,11 @@ ifneq (,$(findstring LJ_TARGET_ARM64 ,$(TARGET_TESTARCH)))
   TARGET_LJARCH= arm64
 else
 ifneq (,$(findstring LJ_TARGET_PPC ,$(TARGET_TESTARCH)))
+  ifneq (,$(findstring LJ_LE 1,$(TARGET_TESTARCH)))
+    TARGET_ARCH= -DLJ_ARCH_ENDIAN=LUAJIT_LE
+  else
+    TARGET_ARCH= -DLJ_ARCH_ENDIAN=LUAJIT_BE
+  endif
   TARGET_LJARCH= ppc
 else
 ifneq (,$(findstring LJ_TARGET_MIPS ,$(TARGET_TESTARCH)))

+ 2 - 0
src/lj_arch.h

@@ -210,11 +210,13 @@
 
 #elif LUAJIT_TARGET == LUAJIT_ARCH_PPC
 
+#ifndef LJ_ARCH_ENDIAN
 #if __BYTE_ORDER__ != __ORDER_BIG_ENDIAN__
 #define LJ_ARCH_ENDIAN		LUAJIT_LE
 #else
 #define LJ_ARCH_ENDIAN		LUAJIT_BE
 #endif
+#endif
 
 #if _LP64
 #define LJ_ARCH_BITS		64