mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: rth@twiddle.net, tony.luck@intel.com, anton@samba.org,
	paulus@samba.org, bunk@kernel.org, kamalesh@linux.vnet.ibm.com,
	rusty@rustcorp.com.au, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] moduleparam: fix alpha, ia64 and ppc64 compile failures
Date: Fri, 8 Feb 2008 14:46:15 -0800	[thread overview]
Message-ID: <20080208144615.9f2fc593.akpm@linux-foundation.org> (raw)
In-Reply-To: <20080208223341.GB15333@jurassic.park.msu.ru>

On Sat, 9 Feb 2008 01:33:41 +0300
Ivan Kokshaysky <ink@jurassic.park.msu.ru> wrote:

> On alpha, ia64 and ppc64 only relocations to local data can go into
> read-only sections. The vast majority of module parameters use the global
> generic param_set_*/param_get_* functions, so the 'const' attribute for
> struct kernel_param is not only useless, but it also causes compile
> failures due to 'section type conflict' in those rare cases where
> param_set/get are local functions.
> 
> This fixes http://bugzilla.kernel.org/show_bug.cgi?id=8964
> 
> Signed-off-by: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
> ---
>  include/linux/moduleparam.h |   12 +++++++++++-
>  1 files changed, 11 insertions(+), 1 deletions(-)
> 
> diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
> index 8126e55..ec62438 100644
> --- a/include/linux/moduleparam.h
> +++ b/include/linux/moduleparam.h
> @@ -62,6 +62,16 @@ struct kparam_array
>  	void *elem;
>  };
>  
> +/* On alpha, ia64 and ppc64 relocations to global data cannot go into
> +   read-only sections (which is part of respective UNIX ABI on these
> +   platforms). 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 +81,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	\
>  	__used								\
>      __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \
>  	= { __param_str_##name, perm, set, get, { arg } }

I think it would have been better to define a new CONFIG_MODULEPARAM_CONST
for those three archictures, rather than muckying up the code like this.

But hey, I get to close a bugzilla report - I'm doing that amlonst monthly
now.  Thanks.


  reply	other threads:[~2008-02-08 22:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-08 22:33 Ivan Kokshaysky
2008-02-08 22:46 ` Andrew Morton [this message]
2008-02-08 23:35   ` Ivan Kokshaysky
2008-02-09 16:50 ` Daniel Drake

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=20080208144615.9f2fc593.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=anton@samba.org \
    --cc=bunk@kernel.org \
    --cc=ink@jurassic.park.msu.ru \
    --cc=kamalesh@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulus@samba.org \
    --cc=rth@twiddle.net \
    --cc=rusty@rustcorp.com.au \
    --cc=tony.luck@intel.com \
    /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

all inboxes | Powered by JetHome®