Package: release.debian.org
Severity: normal
User: release.debian....@packages.debian.org
Usertags: unblock

Hi Release Team,

Package python-greenlet FTBFS on ARM architectures, but it's part of
Jessie. Then upstream fixed the build failure[1][2] and released it in
version 0.4.5 that didn't make it to testing. Then Ubuntu backported
those fixes for Utopic[3]. I did the same, used the fixes for 0.4.2 and
asked an other DD, Bálint Réczey to confirm it. Indeed, he says[4] the
fixes are working correctly.

Please let me upload 0.4.2-2 to t-p-u, debdiff is attached.

Thanks,
Laszlo/GCS

unblock python-greenlet/0.4.2-2

[1] 
https://github.com/python-greenlet/greenlet/commit/c1437e3677b8f2489e9dab3215eedb58590443c8
[2] 
https://github.com/python-greenlet/greenlet/commit/f90dbe4c24a9aed261a5fa9f66fb95ebdb8f21cc
[3] 
http://patches.ubuntu.com/p/python-greenlet/python-greenlet_0.4.2-1ubuntu1.patch
[4] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=751498#63
diff -Nru python-greenlet-0.4.2/debian/changelog python-greenlet-0.4.2/debian/changelog
--- python-greenlet-0.4.2/debian/changelog	2014-02-01 12:34:37.000000000 +0100
+++ python-greenlet-0.4.2/debian/changelog	2014-12-22 08:48:28.000000000 +0100
@@ -1,3 +1,12 @@
+python-greenlet (0.4.2-2) testing-proposed-updates; urgency=medium
+
+  [ Robie Basak <robie.ba...@ubuntu.com> ]
+  * d/p/arm32-{always-use-frame-pointer,unoptimize-return-value}: adjust
+    armhf-specific platform code to fix armhf FTBFS (closes: #751498);
+    cherry-picked from upstream (LP: #1379297).
+
+ -- Laszlo Boszormenyi (GCS) <g...@debian.org>  Mon, 22 Dec 2014 07:42:41 +0000
+
 python-greenlet (0.4.2-1) unstable; urgency=low
 
   * New upstream release.
diff -Nru python-greenlet-0.4.2/debian/patches/arm32-always-use-frame-pointer python-greenlet-0.4.2/debian/patches/arm32-always-use-frame-pointer
--- python-greenlet-0.4.2/debian/patches/arm32-always-use-frame-pointer	1970-01-01 01:00:00.000000000 +0100
+++ python-greenlet-0.4.2/debian/patches/arm32-always-use-frame-pointer	2014-12-22 08:46:22.000000000 +0100
@@ -0,0 +1,34 @@
+From: Robie Basak <robie.ba...@canonical.com>
+Date: Tue, 14 Oct 2014 13:07:59 +0100
+Subject: [PATCH] arm32: make sure gcc uses a frame pointer
+
+This code assumes that there is a frame pointer. When gcc doesn't use a
+frame pointer here and __thumb__ is defined, then the code clobbers r7
+without declaring it to the compiler. If the compiler uses r7 for
+something else, then this causes arbitrary failures, depending on what
+the optimizer did.
+
+To work around this, tell gcc to always use a frame pointer.
+
+Bug: https://github.com/python-greenlet/greenlet/pull/64
+Origin: upstream, https://github.com/python-greenlet/greenlet/commit/c1437e3677b8f2489e9dab3215eedb58590443c8
+Last-Update: 2014-10-15
+
+---
+ platform/switch_arm32_gcc.h | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/platform/switch_arm32_gcc.h b/platform/switch_arm32_gcc.h
+index c6e160d..f74b2bb 100644
+--- a/platform/switch_arm32_gcc.h
++++ b/platform/switch_arm32_gcc.h
+@@ -50,6 +50,9 @@
+ #endif
+ 
+ static int
++#ifdef __GNUC__
++__attribute__((optimize("no-omit-frame-pointer")))
++#endif
+ slp_switch(void)
+ {
+         void *fp;
diff -Nru python-greenlet-0.4.2/debian/patches/arm32-unoptimize-return-value python-greenlet-0.4.2/debian/patches/arm32-unoptimize-return-value
--- python-greenlet-0.4.2/debian/patches/arm32-unoptimize-return-value	1970-01-01 01:00:00.000000000 +0100
+++ python-greenlet-0.4.2/debian/patches/arm32-unoptimize-return-value	2014-12-22 08:46:22.000000000 +0100
@@ -0,0 +1,68 @@
+From 505c91a68aaf5ab56325affd4d8581b32b649cf4 Mon Sep 17 00:00:00 2001
+From: Robie Basak <robie.ba...@canonical.com>
+Date: Tue, 14 Oct 2014 13:16:22 +0100
+Subject: [PATCH] arm32: force return value from asm
+
+In my case, instead of a simple "mov r0, #0", the optimizer had done
+this:
+
+    Between calls to slp_save_state and slp_restore_state, it saved the
+    value now guaranteed to be 0 using "str r0, [r7]".
+
+    Now, at the end, it restores that value into r0 using "ldr r3, [r7]"
+    and then "mov r0, r3".
+
+It isn't clear to me that intermediate values managed by the compiler,
+like this one at [r7], would be preserved in the stack this way,
+especially as at this point we're in a "different" stack (unknown to the
+optimizer).
+
+Instead, prevent the optimizer from re-using a previous result like this
+by forcing it to rely on the inline assembly to produce the result.
+
+This fixes test failures on Ubuntu Utopic using gcc 4.9.1 (-5ubuntu1).
+
+I think even this is still a hack though, and not guaranteed to work.
+Ultimately, gcc can even re-order the "__asm__ volatile" functions at
+will around the entire function, or just wrap each REGS_TO_SAVE
+clobbering call with a simple push/pop, thus not preserving the
+registers between stack switches.
+
+The only way I can see of doing this without relying on undefined
+compiler behaviour is to write the entire slp_switch function in
+assembly for each architecture, instead of inlining it into a C function
+for code reuse.
+
+Bug: https://github.com/python-greenlet/greenlet/pull/65
+Origin: upstream, https://github.com/python-greenlet/greenlet/commit/f90dbe4c24a9aed261a5fa9f66fb95ebdb8f21cc
+Last-Update: 2014-10-15
+
+---
+ platform/switch_arm32_gcc.h | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/platform/switch_arm32_gcc.h b/platform/switch_arm32_gcc.h
+index c6e160d..e1cd797 100644
+--- a/platform/switch_arm32_gcc.h
++++ b/platform/switch_arm32_gcc.h
+@@ -54,6 +54,7 @@ slp_switch(void)
+ {
+         void *fp;
+         register int *stackref, stsizediff;
++        int result;
+         __asm__ volatile ("" : : : REGS_TO_SAVE);
+         __asm__ volatile ("mov r0," REG_FP "\n\tstr r0,%0" : "=m" (fp) : : "r0");
+         __asm__ ("mov %0," REG_SP : "=r" (stackref));
+@@ -67,9 +68,9 @@ slp_switch(void)
+                     );
+                 SLP_RESTORE_STATE();
+         }
+-        __asm__ volatile ("ldr r0,%0\n\tmov " REG_FP ",r0" : : "m" (fp) : "r0");
++        __asm__ volatile ("ldr r0,%1\n\tmov " REG_FP ",r0\n\tmov %0, #0" : "=r" (result) : "m" (fp) : "r0");
+         __asm__ volatile ("" : : : REGS_TO_SAVE);
+-        return 0;
++        return result;
+ }
+ 
+ #endif
+\ No newline at end of file
diff -Nru python-greenlet-0.4.2/debian/patches/series python-greenlet-0.4.2/debian/patches/series
--- python-greenlet-0.4.2/debian/patches/series	2014-02-01 11:31:13.000000000 +0100
+++ python-greenlet-0.4.2/debian/patches/series	2014-12-22 08:46:22.000000000 +0100
@@ -1,2 +1,4 @@
 ppc64le.diff
 support-alpha.patch
+arm32-always-use-frame-pointer
+arm32-unoptimize-return-value

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to