Commit 91d35dd93e14c34539a8005183ea500f25caad02

Authored by Ivan Kokshaysky
Committed by Linus Torvalds
1 parent bc2cda1ebd

moduleparam: fix alpha, ia64 and ppc64 compile failures

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>
Cc: Richard Henderson <rth@twiddle.net>
Cc: "Luck, Tony" <tony.luck@intel.com>
Cc: Anton Blanchard <anton@samba.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Adrian Bunk <bunk@stusta.de>
Cc: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 1 changed file with 11 additions and 1 deletions Side-by-side Diff

include/linux/moduleparam.h
... ... @@ -62,6 +62,16 @@
62 62 void *elem;
63 63 };
64 64  
  65 +/* On alpha, ia64 and ppc64 relocations to global data cannot go into
  66 + read-only sections (which is part of respective UNIX ABI on these
  67 + platforms). So 'const' makes no sense and even causes compile failures
  68 + with some compilers. */
  69 +#if defined(CONFIG_ALPHA) || defined(CONFIG_IA64) || defined(CONFIG_PPC64)
  70 +#define __moduleparam_const
  71 +#else
  72 +#define __moduleparam_const const
  73 +#endif
  74 +
65 75 /* This is the fundamental function for registering boot/module
66 76 parameters. perm sets the visibility in sysfs: 000 means it's
67 77 not there, read bits mean it's readable, write bits mean it's
... ... @@ -71,7 +81,7 @@
71 81 static int __param_perm_check_##name __attribute__((unused)) = \
72 82 BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2)); \
73 83 static const char __param_str_##name[] = prefix #name; \
74   - static struct kernel_param const __param_##name \
  84 + static struct kernel_param __moduleparam_const __param_##name \
75 85 __used \
76 86 __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \
77 87 = { __param_str_##name, perm, set, get, { arg } }