OSDN Git Service

[PATCH] i386: do_test_wp_bit() must not be inlined
authorWilly Tarreau <w@1wt.eu>
Wed, 5 Sep 2007 21:39:11 +0000 (23:39 +0200)
committerWilly Tarreau <w@1wt.eu>
Sat, 8 Sep 2007 17:38:56 +0000 (19:38 +0200)
do_test_wp_bit() has a comment stating that it must not be inlined.
Unfortunately, the trick to prevent it from being inlined is not
reliable under gcc 4.x.

The simple fix consists in specifying the noinline attribute.
Tested and confirmed to produce the correct code for gcc versions
2.95.3, 3.3.6, 3.4.6, 4.0.2, 4.1.1 and 4.2.1.

Special thanks to Axel Reinhold and Richard Kojedzinszky for their
continuous feedback when trying to solve this issue.

Signed-off-by: Willy Tarreau <w@1wt.eu>
arch/i386/mm/init.c

index 0dc1751..2d81117 100644 (file)
@@ -381,7 +381,7 @@ void __init paging_init(void)
  * This function cannot be __init, since exceptions don't work in that
  * section.
  */
-static int do_test_wp_bit(unsigned long vaddr);
+static int __attribute__((noinline)) do_test_wp_bit(unsigned long vaddr);
 
 void __init test_wp_bit(void)
 {
@@ -561,8 +561,8 @@ void __init mem_init(void)
 
 }
 
-/* Put this after the callers, so that it cannot be inlined */
-static int do_test_wp_bit(unsigned long vaddr)
+/* This function must not be inlined */
+static int __attribute__((noinline)) do_test_wp_bit(unsigned long vaddr)
 {
        char tmp_reg;
        int flag;