From: Robie Basak <robie.basak@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;
