All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: David Howells <dhowells@redhat.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] [PATCH] param: Stop gcc from inlining empty weak functions
Date: Fri, 5 Dec 2008 18:58:00 +1030	[thread overview]
Message-ID: <200812051858.00246.rusty@rustcorp.com.au> (raw)
In-Reply-To: <20081203163212.13965.80352.stgit@warthog.procyon.org.uk>

On Thursday 04 December 2008 03:02:12 David Howells wrote:
> Stop gcc from inlining empty weak functions by making them non-empty.  The gcc
> I have for FRV (4.1.2) will inline empty weak functions that are in the same
> file, even if those functions are marked 'noinline'.
> 
> Without this patch, the default arch_get_boot_command_line() is rolled into
> start_kernel(), and the arch specific one is not called, thus making the
> kernel unbootable.
> 
> Signed-off-by: David Howells <dhowells@redhat.com>

Ouch.  I'd prefer to fix this by moving the weak noop version to
kernel/params.c.  You may still need to fix the rest.

Here's what I ended up with (I'll eventually fold it):

commit 4858874241391aa62b5818781f702883e4ddf4ed
Author: Rusty Russell <rusty@rustcorp.com.au>
Date:   Fri Dec 5 18:56:34 2008 +1030

    Move arch_get_boot_command_line out of init/main.c for broken gccs.

diff --git a/include/linux/init.h b/include/linux/init.h
index 71cd0f5..8cd1a93 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -150,7 +150,7 @@ extern unsigned int reset_devices;
 
 /* used by init/main.c */
 void setup_arch(void);
-void arch_get_cmdline(char *cmdline);
+void arch_get_boot_command_line(void);
 void prepare_namespace(void);
 
 extern void (*late_time_init)(void);
diff --git a/init/main.c b/init/main.c
index 9595dba..f6032ba 100644
--- a/init/main.c
+++ b/init/main.c
@@ -528,11 +528,6 @@ void __init __weak thread_info_cache_init(void)
 {
 }
 
-/* If the arch already sets boot_command_line, we need do nothing. */
-void __init __weak arch_get_boot_command_line(void)
-{
-}
-
 /* Ideally, this would take a 'const char *cmdline' param. */
 asmlinkage void __init start_kernel(void)
 {
diff --git a/kernel/params.c b/kernel/params.c
index 69dd623..7fac630 100644
--- a/kernel/params.c
+++ b/kernel/params.c
@@ -30,6 +30,15 @@
 #define DEBUGP(fmt, a...)
 #endif
 
+/*
+ * If the arch already sets boot_command_line, we need do nothing. 
+ * This is not in init/main.c because David Howells reports that on FRV
+ * gcc 4.1.2 will inline empty functions, ignoring noinline and weak.
+ */
+void __init __weak arch_get_boot_command_line(void)
+{
+}
+
 static inline char dash2underscore(char c)
 {
 	if (c == '-')



  reply	other threads:[~2008-12-05  8:28 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-03 16:32 [PATCH 1/3] param: Adapt MN10300 to the new parameter handling regime David Howells
2008-12-03 16:32 ` [PATCH 2/3] [PATCH] param: Stop gcc from inlining empty weak functions David Howells
2008-12-05  8:28   ` Rusty Russell [this message]
2008-12-05 12:02     ` David Howells
2008-12-03 16:32 ` [PATCH 3/3] [PATCH] param: Adapt FRV to the new parameter handling regime David Howells
2008-12-05  8:25 ` [PATCH 1/3] param: Adapt MN10300 " Rusty Russell
2008-12-05 11:58   ` David Howells
2008-12-05 12:55     ` Rusty Russell
2008-12-05 13:07       ` David Howells
2008-12-07  9:21       ` Rusty Russell
2008-12-10 10:39         ` David Howells

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200812051858.00246.rusty@rustcorp.com.au \
    --to=rusty@rustcorp.com.au \
    --cc=dhowells@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.