Skip to contentSkip to conversation

libffi: fix powerpc build breakage

PATCH Superseded Gustavo Zacarias 3 participants 5 messages Feb 22, 2013

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libffi: fix powerpc build breakage

Happens with the latest release when there are no FP registers. Fixes:
http://autobuild.buildroot.net/results/bc43261d3ddc9d4c320522563249f4a0695a35a4/

---
 ...ppc-build-breakage-when-there-are-no-FPRs.patch | 46 ++++++++++++++++++++++
 1 file changed, 46 insertions(+)
 create mode 100644 package/libffi/libffi-002-Fix-ppc-build-breakage-when-there-are-no-FPRs.patch
package/libffi/libffi-002-Fix-ppc-build-breakage-when-there-are-no-FPRs.patch new file +46 -0
new file mode 100644
index 0000000..5f0e576
@@ -0,0 +1,46 @@
+From f800706fa2f4adb5192e859cc5d283c8ab766adf Mon Sep 17 00:00:00 2001
+From: Gustavo Zacarias <[email protected]>
+Date: Fri, 22 Feb 2013 13:32:32 -0300
+Subject: [PATCH] Fix ppc build breakage when there are no FPRs
+
+Introduced by 8bd15d139a58a6e46dc90a1cb2d89f59f32f06c7
+If there are no FP registers there's build breakage:
+
+../src/powerpc/ffi.c: In function 'ffi_prep_args_SYSV':
+../src/powerpc/ffi.c:379:7: error: 'fparg_count' undeclared (first use
+in this function)
+../src/powerpc/ffi.c:379:7: note: each undeclared identifier is reported
+only once for each function it appears in
+../src/powerpc/ffi.c:379:21: error: 'NUM_FPR_ARG_REGISTERS' undeclared
+(first use in this function)
+
+Hit it when building for a SPE PPC target (e500v1/v2 cores) that uses GP
+registers for FP math.
+
+Signed-off-by: Gustavo Zacarias <[email protected]>
+---
+ src/powerpc/ffi.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/powerpc/ffi.c b/src/powerpc/ffi.c
+index f3a96a1..6220f0d 100644
+--- a/src/powerpc/ffi.c
++++ b/src/powerpc/ffi.c
+@@ -372,13 +372,13 @@ ffi_prep_args_SYSV (extended_cif *ecif, unsigned *const stack)
+   /* Check that we didn't overrun the stack...  */
+   FFI_ASSERT (copy_space.c >= next_arg.c);
+   FFI_ASSERT (gpr_base.u <= stacktop.u - ASM_NEEDS_REGISTERS);
++#ifndef __NO_FPRS__
+   /* The assert below is testing that the number of integer arguments agrees
+      with the number found in ffi_prep_cif_machdep().  However, intarg_count
+      is incremeneted whenever we place an FP arg on the stack, so account for
+      that before our assert test.  */
+   if (fparg_count > NUM_FPR_ARG_REGISTERS)
+     intarg_count -= fparg_count - NUM_FPR_ARG_REGISTERS;
+-#ifndef __NO_FPRS__
+   FFI_ASSERT (fpr_base.u
+ 	      <= stacktop.u - ASM_NEEDS_REGISTERS - NUM_GPR_ARG_REGISTERS);
+ #endif
+-- 
+1.7.12.4
+
Signature · 1 line
1.7.12.4
#1 lore raw

PATCH 1/1 libffi: fix powerpc build breakage

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Gustavo" == Gustavo Zacarias <[email protected]> writes:

Gustavo> Happens with the latest release when there are no FP registers. Gustavo> Fixes:
Gustavo> http://autobuild.buildroot.net/results/bc43261d3ddc9d4c320522563249f4a0695a35a4/

Thanks, but probably it makes more sense to use Gilles' version:

http://sourceware.org/ml/libffi-discuss/2013/msg00079.html

Signature · 1 line
Bye, Peter Korsgaard
#2 lore raw

PATCH 1/1 libffi: fix powerpc build breakage

Hi Gustavo, Peter,

2013/2/22 Peter Korsgaard <[email protected]>:

Quoted 10 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Gustavo" == Gustavo Zacarias <[email protected]> writes:

Gustavo> Happens with the latest release when there are no FP registers. Gustavo> Fixes:
Gustavo> http://autobuild.buildroot.net/results/bc43261d3ddc9d4c320522563249f4a0695a35a4/

Thanks, but probably it makes more sense to use Gilles' version:

http://sourceware.org/ml/libffi-discuss/2013/msg00079.html

Sorry for late notice. I meant to send an email to the list today about it, but you guys beat me to it.
regards,
Gilles.

#4 lore raw

PATCH 1/1 libffi: fix powerpc build breakage

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Gustavo" == Gustavo Zacarias <[email protected]> writes:

Quoted 3 lines · Peter Korsgaard
Quoted 3 lines

Thanks, but probably it makes more sense to use Gilles' version:

http://sourceware.org/ml/libffi-discuss/2013/msg00079.html

Gustavo> Huh, missed it by a few hours, happens when you look at things Gustavo> the night before fixing them :) Honestly it doesn't make more Gustavo> sense since it's the same, it's just more fair, sent V2.

Yes, the patches are equivalent, just that it looks more likely that Gilles' patch will end up in upstream git (as it was posted first/acked), so it is easier for people to verify that it can be dropped next time libffi gets bumped.

Signature · 1 line
Bye, Peter Korsgaard