Issue #8314: Fix unsigned long long bug in libffi on Sparc v8.
diff --git a/Misc/NEWS b/Misc/NEWS
index 1334cdc..f3ba45b 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -194,6 +194,8 @@
 Extension Modules
 -----------------
 
+- Issue #8314: Fix unsigned long long bug in libffi on Sparc v8.
+
 - Issue #1039, #8154: Fix os.execlp() crash with missing 2nd argument.
 
 - Issue #8156: bsddb module updated to version 4.8.4.
diff --git a/Modules/_ctypes/libffi/src/sparc/v8.S b/Modules/_ctypes/libffi/src/sparc/v8.S
index 2c4eb60..bef1b68 100644
--- a/Modules/_ctypes/libffi/src/sparc/v8.S
+++ b/Modules/_ctypes/libffi/src/sparc/v8.S
@@ -213,6 +213,10 @@
 	be,a	done1
 	 ldd	[%fp-8], %i0
 
+	cmp	%o0, FFI_TYPE_UINT64
+	be,a	done1
+	 ldd	[%fp-8], %i0
+
 	ld	[%fp-8], %i0
 done1:
 	jmp	%i7+8