summaryrefslogtreecommitdiff
path: root/recipes/linux/linux-openmoko-2.6.32/0001-add-noinline-and-noclone-attributes-to-naked-functio.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes/linux/linux-openmoko-2.6.32/0001-add-noinline-and-noclone-attributes-to-naked-functio.patch')
-rw-r--r--recipes/linux/linux-openmoko-2.6.32/0001-add-noinline-and-noclone-attributes-to-naked-functio.patch52
1 files changed, 52 insertions, 0 deletions
diff --git a/recipes/linux/linux-openmoko-2.6.32/0001-add-noinline-and-noclone-attributes-to-naked-functio.patch b/recipes/linux/linux-openmoko-2.6.32/0001-add-noinline-and-noclone-attributes-to-naked-functio.patch
new file mode 100644
index 0000000000..ac1efaec25
--- /dev/null
+++ b/recipes/linux/linux-openmoko-2.6.32/0001-add-noinline-and-noclone-attributes-to-naked-functio.patch
@@ -0,0 +1,52 @@
+From 6d97e1b1c2434fb769be7a72813efd11925225a9 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sun, 6 Jun 2010 03:28:43 +0200
+Subject: [PATCH 03/22] add noinline and noclone attributes to naked functions
+
+Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
+---
+ include/linux/compiler-gcc.h | 11 ++++++++++-
+ include/linux/compiler-gcc4.h | 2 ++
+ 2 files changed, 12 insertions(+), 1 deletions(-)
+
+diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
+index a3ed7cb..132a651 100644
+--- a/include/linux/compiler-gcc.h
++++ b/include/linux/compiler-gcc.h
+@@ -58,8 +58,12 @@
+ * naked functions because then mcount is called without stack and frame pointer
+ * being set up and there is no chance to restore the lr register to the value
+ * before mcount was called.
++ *
++ * The asm() bodies of naked functions often depend on standard calling conventions,
++ * therefore they must be noinline and noclone. GCC 4.[56] currently fail to enforce
++ * this, so we must do so ourselves. See GCC PR44290.
+ */
+-#define __naked __attribute__((naked)) notrace
++#define __naked __attribute__((naked)) noinline __noclone notrace
+
+ #define __noreturn __attribute__((noreturn))
+
+@@ -84,3 +88,8 @@
+ #define _gcc_header(x) __gcc_header(linux/compiler-gcc##x.h)
+ #define gcc_header(x) _gcc_header(x)
+ #include gcc_header(__GNUC__)
++
++#if !defined(__noclone)
++#define __noclone /* not needed */
++#endif
++
+diff --git a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc4.h
+index 450fa59..cd5932a 100644
+--- a/include/linux/compiler-gcc4.h
++++ b/include/linux/compiler-gcc4.h
+@@ -36,4 +36,6 @@
+ the kernel context */
+ #define __cold __attribute__((__cold__))
+
++/* Mark a function definition as prohibited from being cloned. */
++#define __noclone __attribute__((__noclone__))
+ #endif
+--
+1.7.1.1
+