Skip to content

Instantly share code, notes, and snippets.

@classilla
Created December 20, 2018 13:39
Show Gist options
  • Save classilla/0cab35c43d74c79340d244b436427995 to your computer and use it in GitHub Desktop.
Save classilla/0cab35c43d74c79340d244b436427995 to your computer and use it in GitHub Desktop.
A workaround to allow compilation of recent versions of MAME with gcc on PowerPC, including ppc64 and ppc64le.
diff --git a/3rdparty/bx/include/bx/platform.h b/3rdparty/bx/include/bx/platform.h
index e0031ec2c38..5cb5f65e3ad 100644
--- a/3rdparty/bx/include/bx/platform.h
+++ b/3rdparty/bx/include/bx/platform.h
@@ -133,8 +133,14 @@
#endif //
#if BX_CPU_PPC
-# undef BX_CPU_ENDIAN_BIG
-# define BX_CPU_ENDIAN_BIG 1
+// _LITTLE_ENDIAN exists on ppc64le.
+# if _LITTLE_ENDIAN
+# undef BX_CPU_ENDIAN_LITTLE
+# define BX_CPU_ENDIAN_LITTLE 1
+# else
+# undef BX_CPU_ENDIAN_BIG
+# define BX_CPU_ENDIAN_BIG 1
+# endif
#else
# undef BX_CPU_ENDIAN_LITTLE
# define BX_CPU_ENDIAN_LITTLE 1
diff --git a/makefile b/makefile
index 11b5a3a27b1..059a5192df0 100644
--- a/makefile
+++ b/makefile
@@ -394,6 +394,12 @@ BIGENDIAN := 1
endif
endif # BIGENDIAN
+# Work around an issue with long doubles on ppc64 (#3157)
+ifneq (,$(findstring ppc64,$(UNAME)))
+ARCHOPTS_C += -mlong-double-64
+ARCHOPTS_CXX += -mlong-double-64
+endif
+
ifndef PYTHON_EXECUTABLE
PYTHON := python
else
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment