summaryrefslogtreecommitdiff
path: root/ext/ffi_c/Platform.c
diff options
context:
space:
mode:
authorKevin Menard <kevin@nirvdrum.com>2017-05-18 15:27:53 -0400
committertduehr <tduehr@users.noreply.github.com>2017-05-18 14:27:53 -0500
commit4c926587e565a03d501146266bc53c7c8b044c2e (patch)
tree96983efc28cd74ba91e74f80ff8c4101f0906a70 /ext/ffi_c/Platform.c
parenta707956d690ecf5563626f553d39f60fdb38514e (diff)
downloadffi-4c926587e565a03d501146266bc53c7c8b044c2e.tar.gz
Normalize sparc64 to sparcv9. (#575)
Linux appears to report as 'sparc64' rather than 'sparcv9' when running on the same CPU. Since the CPU features are the same, normalize to 'sparcv9' to keep things simple.
Diffstat (limited to 'ext/ffi_c/Platform.c')
-rw-r--r--ext/ffi_c/Platform.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/ext/ffi_c/Platform.c b/ext/ffi_c/Platform.c
index 1305ad2..de114a8 100644
--- a/ext/ffi_c/Platform.c
+++ b/ext/ffi_c/Platform.c
@@ -66,12 +66,20 @@ static VALUE PlatformModule = Qnil;
#elif defined(__ppc__) || defined(__powerpc__) || defined(__powerpc)
# define CPU "ppc"
-/* Need to check for __sparcv9 first, because __sparc will be defined either way. */
+/*
+ * Need to check for __sparcv9 first, because __sparc will be defined either way.
+ * Note that __sparcv9 seems to only be set for Solaris. On Linux, __sparc will
+ * be set, along with __arch64__ if a 64-bit platform.
+ */
#elif defined(__sparcv9__) || defined(__sparcv9)
# define CPU "sparcv9"
#elif defined(__sparc__) || defined(__sparc)
-# define CPU "sparc"
+# if defined(__arch64__)
+# define CPU "sparcv9"
+# else
+# define CPU "sparc"
+# endif
#elif defined(__arm__) || defined(__arm)
# define CPU "arm"