Re: [PATCH] i386/gcc bug with do_test_wp_bit

From: Zachary Amsden
Date: Tue Oct 05 2004 - 22:22:12 EST


I agree the code obviously looks ok, I will verify against 2.6.9-rc3 anyways and send an updated patch that gets a non-tweaked gcc 3.3.3 build to boot. Additional fixes are needed for regparm compliance between prototypes and functions; I've done these for i386, but may have missed some in other architectures. I'd also like to get rid of the apparently harmless lvalue warnings I get from gcc 3.3.3.

I checked the gcc docs but couldn't find any versions where noinline was unsupported, although I should have assumed otherwise.

Zach

Linus Torvalds wrote:

On Tue, 5 Oct 2004, Zachary Amsden wrote:


I've included a small trivial fix that is harmless for users not using gcc 3.3.3. Testing: my 2.6 kernel now boots when compiled with gcc 3.3.3 compiler.



Thanks. However, it really should use the "noinline" define that we have for this, and that doesn't upset older versions of gcc that don't understand the "noinline" attribute.

Also, declaration and definition should match, even if gcc doesn't seem to catch that.

So here's the version I committed. It should be obviously ok, but it's still a good idea to verify..

Linus

---
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2004/10/05 18:51:53-07:00 torvalds@xxxxxxxxxxxx # i386: mark do_test_wp_bit() noinline
# # As reported by Zachary Amsden <zach@xxxxxxxxxx>,
# some gcc versions will inline the function even when
# it is declared after the call-site. This particular
# function must not be inlined, since the exception
# recovery doesn't like __init sections (which the caller
# is in).
# # arch/i386/mm/init.c
# 2004/10/05 18:51:43-07:00 torvalds@xxxxxxxxxxxx +2 -2
# i386: mark do_test_wp_bit() noinline
# # As reported by Zachary Amsden <zach@xxxxxxxxxx>,
# some gcc versions will inline the function even when
# it is declared after the call-site. This particular
# function must not be inlined, since the exception
# recovery doesn't like __init sections (which the caller
# is in).
# diff -Nru a/arch/i386/mm/init.c b/arch/i386/mm/init.c
--- a/arch/i386/mm/init.c 2004-10-05 19:04:53 -07:00
+++ b/arch/i386/mm/init.c 2004-10-05 19:04:53 -07:00
@@ -45,7 +45,7 @@
DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
unsigned long highstart_pfn, highend_pfn;

-static int do_test_wp_bit(void);
+static int noinline do_test_wp_bit(void);

/*
* Creates a middle page table and puts a pointer to it in the
@@ -673,7 +673,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;



-
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/