On Mon, Feb 06, 2023 at 08:04:13PM +0100, Stephen Kitt wrote:
> 
> I’m afraid there isn’t much I can do about that, other than ask upstream to
> add MIPS support.
> 
> Given the RC severity of this bug, I’ll consider the main point of the bug to
> be the latter part:
> 
> > The RC severity is based on looking at a related question:
> > How did intelrdfpmath compile on new platforms like powerpc/arm/s390x
> > that never had any explicit support in intelrdfpmath?
> > 
> > intelrdfpmath (2.0u2-2) unstable; urgency=medium
> >   * Assume unknown architectures are “EFI2”.
> > 
> > LIBRARY/float128/architecture.h:
> >   #if defined(ct) || defined(efi2)
> >   #   undef  _M_AMD64
> >   #   define _M_AMD64
> >   #endif
> > 
> > This builds, but the (used) definition
> >   #       define ENDIANESS little_endian
> > isn't correct on s390x, and neither is
> >   #           define BITS_PER_LONG   64
> > on 32bit arm.
> 
> Ah, I knew that would bite me some day...
> 
> I’m updating intelrdfpmath to apply the architecture definitions used in
> libmongocrypt (see
> <https://github.com/mongodb/libmongocrypt/blob/master/cmake/IntelDFP.cmake>):
> armel/armhf are assumed to behave like i386 (I haven’t checked whether that
> makes sense), arm64/ppc64el/riscv64 are assumed to behave like amd64, and
> s390x is supported explicitly.
> 
> If you want to track the unsupported architectures, please open a new bug. As
> far as I can tell, even if libmongocrypt were built in Debian using its
> embedded copy of intelrdfpmath, it would fail on the same architectures.
> 
So, based on the fact that upstream treats x86 and x86_64 as having the
same data model, I came up with the attached patch.  It allows the build
to succeed on both mips64el and mipsel.  I am preparing to test (using
the libmongocrypt tests as a proxy) and I will report back with the
results of those tests.

Regards,

-Roberto


-- 
Roberto C. Sánchez
Index: intelrdfpmath-2.0u2/LIBRARY/float128/dpml_private.h
===================================================================
--- intelrdfpmath-2.0u2.orig/LIBRARY/float128/dpml_private.h
+++ intelrdfpmath-2.0u2/LIBRARY/float128/dpml_private.h
@@ -212,7 +212,12 @@ versions until we need them. ] */
 
 #elif (ARCHITECTURE == mips)
 
-#    include "mips_macros.h"
+/*
+ * This header doesn't exist and the attempted inclusion causes a FTBFS.
+ * Don't try to include it, but also leave this branch here so that the
+ * absence of it doesn't result in raising the error below.
+    include "mips_macros.h"
+*/
 
 #elif (ARCHITECTURE == hp_pa)
 
Index: intelrdfpmath-2.0u2/LIBRARY/float128/architecture.h
===================================================================
--- intelrdfpmath-2.0u2.orig/LIBRARY/float128/architecture.h
+++ intelrdfpmath-2.0u2/LIBRARY/float128/architecture.h
@@ -144,17 +144,23 @@
 #	define INT_8  signed char
 #	define INT_16 signed short
 #	define INT_32 signed int
-#	undef  INT_64
+#	define INT_64 long long
 #	undef  INT_128
 #	define U_INT_8  unsigned char
 #	define U_INT_16 unsigned short
 #	define U_INT_32 unsigned int
-#	undef  U_INT_64
+#	define U_INT_64 unsigned long long
 #	undef  U_INT_128
 
-#	define WORD      INT_32
-#	define U_WORD  U_INT_32
-#	define BITS_PER_WORD 32
+#       if 0
+#	    define WORD      INT_32
+#	    define U_WORD  U_INT_32
+#	    define BITS_PER_WORD 32
+#       else
+#	    define WORD      INT_64
+#	    define U_WORD  U_INT_64
+#	    define BITS_PER_WORD 64
+#       endif
 
 #	define HALF_WORD      INT_16
 #	define U_HALF_WORD  U_INT_16
Index: intelrdfpmath-2.0u2/LIBRARY/float128/dpml_exception.h
===================================================================
--- intelrdfpmath-2.0u2.orig/LIBRARY/float128/dpml_exception.h
+++ intelrdfpmath-2.0u2/LIBRARY/float128/dpml_exception.h
@@ -325,7 +325,7 @@ typedef struct {
 #	define PROCESS_DENORMS 1
 #	define DPML_EXCEPTION_HANDLER DPML_EXCEPTION_NAME
 #	define EXCEPTION_ARGUMENTS( error_code ) error_code
-#	define PLATFORM_SPECIFIC_HEADER_FILE "mips_exception.c"
+//#	define PLATFORM_SPECIFIC_HEADER_FILE "mips_exception.c"
 
 #   elif ARCHITECTURE == hp_pa
 #	define PROCESS_DENORMS 1

Reply via email to