[PATCH] Add noinline attribute

From: Andi Kleen
Date: Wed Jan 14 2004 - 03:32:35 EST



do_test_wp_bit cannot be inlined, otherwise the kernel doesn't boot
because the exception tables get reordered.

Add a new noinline attribute to compiler.h and use it.

This patch is needed for the next unit-at-a-time patch.

-Andi

diff -u linux-34/arch/i386/mm/init.c-o linux-34/arch/i386/mm/init.c
--- linux-34/arch/i386/mm/init.c-o 2004-01-09 09:27:09.000000000 +0100
+++ linux-34/arch/i386/mm/init.c 2004-01-13 22:19:19.000000000 +0100
@@ -555,7 +555,7 @@
* This function cannot be __init, since exceptions don't work in that
* section. Put this after the callers, so that it cannot be inlined.
*/
-static int do_test_wp_bit(void)
+static int noinline do_test_wp_bit(void)
{
char tmp_reg;
int flag;
diff -u linux-34/include/linux/compiler.h-o linux-34/include/linux/compiler.h
--- linux-34/include/linux/compiler.h-o 2003-11-24 04:46:36.000000000 +0100
+++ linux-34/include/linux/compiler.h 2004-01-13 22:17:26.000000000 +0100
@@ -76,6 +76,10 @@
# define __attribute_pure__ /* unimplemented */
#endif

+#ifndef noinline
+#define noinline
+#endif
+
/* Optimization barrier */
#ifndef barrier
# define barrier() __memory_barrier()
diff -u linux-34/include/linux/compiler-gcc3.h-o linux-34/include/linux/compiler-gcc3.h
--- linux-34/include/linux/compiler-gcc3.h-o 2003-09-28 10:53:23.000000000 +0200
+++ linux-34/include/linux/compiler-gcc3.h 2004-01-13 22:36:22.000000000 +0100
@@ -20,3 +22,7 @@
#endif

#define __attribute_pure__ __attribute__((pure))
+
+#if __GNUC_MINOR__ >= 1
+#define noinline __attribute__((noinline))
+#endif
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/