Skip to contentSkip to conversation

edgerouter: libffi: fix build with soft-float tune

PATCH Peter Kjellerstedt 1 participant 1 message May 10, 2016

lore
Share & tools
lore
#0 lore raw

FYI, MIPS o32 softfloat does not build either. We have been using the attached patch that I found on the net to fix this.

//Peter

Quoted 57 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Ruslan Babayev
Sent: den 10 maj 2016 02:48
To: [email protected]
Subject: [OE-core] [PATCH 2/2] edgerouter: libffi: fix build with soft- float tune

---
 .../recipes-support/libffi/libffi/mips-n32-soft-float.patch | 13
+++++++++++++
 meta/recipes-support/libffi/libffi_3.2.1.bb                 |  1 +
 2 files changed, 14 insertions(+)
 create mode 100644 meta/recipes-support/libffi/libffi/mips-n32-soft-

float.patch

(quoted diff) +0 -0

float.patch b/meta/recipes-support/libffi/libffi/mips-n32-soft- float.patch
new file mode 100644
index 0000000..c901614

meta/recipes-support/libffi/libffi/mips-n32-soft-float.patch new file +13 -0
@@ -0,0 +1,13 @@
+Index: libffi-3.2.1/src/mips/n32.S
+===================================================================
+--- libffi-3.2.1.orig/src/mips/n32.S
++++ libffi-3.2.1/src/mips/n32.S
+@@ -30,7 +30,7 @@
+
+ /* Only build this code if we are compiling for n32 */
+
+-#if defined(FFI_MIPS_N32)
++#if defined(FFI_MIPS_N32) && !defined(__mips_soft_float)
+
+ #define callback a0
+ #define bytes	 a2
meta/recipes-support/libffi/libffi_3.2.1.bb +0 -0
index 72e25fb..5b57e79 100644
@@ -12,6 +12,7 @@ LIC_FILES_CHKSUM =

"file://LICENSE;md5=3610bb17683a0089ed64055416b2ae1b"

 SRC_URI = "ftp://sourceware.org/pub/libffi/${BP}.tar.gz \
            file://not-win32.patch \

file://0001-mips-Use-compiler-internal-define-for-linux.patch
\

meta/recipes-support/libffi/libffi_3.2.1.bb +1 -1
+           file://mips-n32-soft-float.patch \
 	   "
 
 SRC_URI[md5sum] = "83b89587607e3eb65c70d361f13bab43"
--

2.7.4

Quoted 5 lines

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

src/mips/o32.S renamed from src/mips/o32.S.orig +17 -0
@@ -82,13 +82,16 @@
 		
 	ADDU	$sp, 4 * FFI_SIZEOF_ARG		# adjust $sp to new args
 
+#ifndef __mips_soft_float
 	bnez	t0, pass_d			# make it quick for int
+#endif
 	REG_L	a0, 0*FFI_SIZEOF_ARG($sp)	# just go ahead and load the
 	REG_L	a1, 1*FFI_SIZEOF_ARG($sp)	# four regs.
 	REG_L	a2, 2*FFI_SIZEOF_ARG($sp)
 	REG_L	a3, 3*FFI_SIZEOF_ARG($sp)
 	b	call_it
 
+#ifndef __mips_soft_float
 pass_d:
 	bne	t0, FFI_ARGS_D, pass_f
 	l.d	$f12, 0*FFI_SIZEOF_ARG($sp)	# load $fp regs from args
@@ -130,6 +133,7 @@
  #	bne	t0, FFI_ARGS_F_D, call_it
 	l.s	$f12, 0*FFI_SIZEOF_ARG($sp)	# load $fp regs from args
 	l.d	$f14, 2*FFI_SIZEOF_ARG($sp)	# passing double and float
+#endif
 
 call_it:	
 	# Load the function pointer
@@ -158,14 +162,23 @@
 	bne     t2, FFI_TYPE_FLOAT, retdouble
 	jalr	t9
 	REG_L	t0, SIZEOF_FRAME + 4*FFI_SIZEOF_ARG($fp)
+#ifndef __mips_soft_float
 	s.s	$f0, 0(t0)
+#else
+	REG_S	v0, 0(t0)
+#endif
 	b	epilogue
 
 retdouble:	
 	bne	t2, FFI_TYPE_DOUBLE, noretval
 	jalr	t9
 	REG_L	t0, SIZEOF_FRAME + 4*FFI_SIZEOF_ARG($fp)
+#ifndef __mips_soft_float
 	s.d	$f0, 0(t0)
+#else
+	REG_S	v1, 4(t0)
+	REG_S	v0, 0(t0)
+#endif
 	b	epilogue
 	
 noretval:	
@@ -261,9 +274,11 @@
 	li	$13, 1		# FFI_O32
 	bne	$16, $13, 1f	# Skip fp save if FFI_O32_SOFT_FLOAT
 	
+#ifndef __mips_soft_float
 	# Store all possible float/double registers.
 	s.d	$f12, FA_0_0_OFF2($fp)
 	s.d	$f14, FA_1_0_OFF2($fp)
+#endif
 1:	
 	# Call ffi_closure_mips_inner_O32 to do the work.
 	la	t9, ffi_closure_mips_inner_O32
@@ -281,6 +296,7 @@
 	li	$13, 1		# FFI_O32
 	bne	$16, $13, 1f	# Skip fp restore if FFI_O32_SOFT_FLOAT
 
+#ifndef __mips_soft_float
 	li	$9, FFI_TYPE_FLOAT
 	l.s	$f0, V0_OFF2($fp)
 	beq	$8, $9, closure_done
@@ -288,6 +304,7 @@
 	li	$9, FFI_TYPE_DOUBLE
 	l.d	$f0, V0_OFF2($fp)
 	beq	$8, $9, closure_done
+#endif
 1:	
 	REG_L	$3, V1_OFF2($fp)
 	REG_L	$2, V0_OFF2($fp)