From: Chuck Ebbert <cebbert@redhat.com>
To: Al Viro <viro@ZenIV.linux.org.uk>
Cc: Sam Ravnborg <sam@ravnborg.org>, linux-kernel@vger.kernel.org
Subject: Re: section breakage on ppc64 (aka __devinitconst is broken by design)
Date: Thu, 07 Feb 2008 13:33:50 -0500 [thread overview]
Message-ID: <47AB4F0E.3050907@redhat.com> (raw)
In-Reply-To: <20080203130844.GS27894@ZenIV.linux.org.uk>
On 02/03/2008 08:08 AM, Al Viro wrote:
>
> The reason why it didn't visibly bite us before is that usually __devinit...
> just expanded to nothing (unless you disable HOTPLUG, which requires
> EMBEDDED, which wasn't apparently common enough for ppc64 builds).
>
> Suggestions?
This ugly hackset was needed to get 2.6.24 to build with GCC 4.3. It would
be nice to get a real fix...
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -62,6 +62,15 @@ struct kparam_array
void *elem;
};
+/* On some platforms relocations to global data cannot go into read-only
+ sections, so 'const' makes no sense and even causes compile failures
+ with some compilers. */
+#if defined(CONFIG_ALPHA) || defined(CONFIG_IA64) || defined(CONFIG_PPC64)
+#define __moduleparam_const
+#else
+#define __moduleparam_const const
+#endif
+
/* This is the fundamental function for registering boot/module
parameters. perm sets the visibility in sysfs: 000 means it's
not there, read bits mean it's readable, write bits mean it's
@@ -71,7 +80,7 @@ struct kparam_array
static int __param_perm_check_##name __attribute__((unused)) = \
BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2)); \
static const char __param_str_##name[] = prefix #name; \
- static struct kernel_param const __param_##name \
+ static struct kernel_param __moduleparam_const __param_##name \
__attribute_used__ \
__attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \
= { __param_str_##name, perm, set, get, { arg } }
--- linux-2.6.24.noarch.orig/include/linux/module.h
+++ linux-2.6.24.noarch/include/linux/module.h
@@ -30,6 +30,15 @@
#define MODULE_NAME_LEN (64 - sizeof(unsigned long))
+/* On some platforms relocations to global data cannot go into read-only
+ sections, so 'const' makes no sense and even causes compile failures
+ with some compilers. */
+#if defined(CONFIG_ALPHA) || defined(CONFIG_IA64) || defined(CONFIG_PPC64)
+#define __ksym_const
+#else
+#define __ksym_const const
+#endif
+
struct kernel_symbol
{
unsigned long value;
@@ -192,7 +201,7 @@ void *__symbol_get_gpl(const char *symbo
static const char __kstrtab_##sym[] \
__attribute__((section("__ksymtab_strings"))) \
= MODULE_SYMBOL_PREFIX #sym; \
- static const struct kernel_symbol __ksymtab_##sym \
+ static __ksym_const struct kernel_symbol __ksymtab_##sym \
__attribute_used__ \
__attribute__((section("__ksymtab" sec), unused)) \
= { (unsigned long)&sym, __kstrtab_##sym }
next prev parent reply other threads:[~2008-02-07 18:34 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-03 13:08 section breakage on ppc64 (aka __devinitconst is broken by design) Al Viro
2008-02-03 17:26 ` Sam Ravnborg
2008-02-03 18:02 ` Al Viro
2008-02-03 20:30 ` Sam Ravnborg
2008-02-03 21:02 ` Al Viro
2008-02-04 0:27 ` Olivier Galibert
2008-02-07 18:33 ` Chuck Ebbert [this message]
2008-02-07 18:54 ` Sam Ravnborg
2008-02-08 8:14 ` Jan Beulich
2008-02-08 8:47 ` Sam Ravnborg
2008-02-08 9:17 ` Jan Beulich
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=47AB4F0E.3050907@redhat.com \
--to=cebbert@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sam@ravnborg.org \
--cc=viro@ZenIV.linux.org.uk \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox