
From: David Mosberger <davidm@napali.hpl.hp.com>

With gcc-3.4 we need "attribute((used))" declarations to get "make
modules_install" to work.

Otherwise these sections get dropped from the final image (I assume).



---

 include/linux/module.h      |    3 +++
 include/linux/moduleparam.h |    1 +
 scripts/modpost.c           |    1 +
 3 files changed, 5 insertions(+)

diff -puN include/linux/module.h~gcc-3_4-needs-attribute_used include/linux/module.h
--- 25/include/linux/module.h~gcc-3_4-needs-attribute_used	2004-01-12 23:30:29.000000000 -0800
+++ 25-akpm/include/linux/module.h	2004-01-12 23:30:29.000000000 -0800
@@ -60,6 +60,7 @@ search_extable(const struct exception_ta
 #define __module_cat(a,b) ___module_cat(a,b)
 #define __MODULE_INFO(tag, name, info)					  \
 static const char __module_cat(name,__LINE__)[]				  \
+  __attribute_used__							  \
   __attribute__((section(".modinfo"),unused)) = __stringify(tag) "=" info
 
 #define MODULE_GENERIC_TABLE(gtype,name)			\
@@ -142,6 +143,7 @@ void *__symbol_get_gpl(const char *symbo
 #define __CRC_SYMBOL(sym, sec)					\
 	extern void *__crc_##sym __attribute__((weak));		\
 	static const unsigned long __kcrctab_##sym		\
+	__attribute_used__					\
 	__attribute__((section("__kcrctab" sec), unused))	\
 	= (unsigned long) &__crc_##sym;
 #else
@@ -155,6 +157,7 @@ void *__symbol_get_gpl(const char *symbo
 	__attribute__((section("__ksymtab_strings")))		\
 	= MODULE_SYMBOL_PREFIX #sym;                    	\
 	static const struct kernel_symbol __ksymtab_##sym	\
+	__attribute_used__					\
 	__attribute__((section("__ksymtab" sec), unused))	\
 	= { (unsigned long)&sym, __kstrtab_##sym }
 
diff -puN include/linux/moduleparam.h~gcc-3_4-needs-attribute_used include/linux/moduleparam.h
--- 25/include/linux/moduleparam.h~gcc-3_4-needs-attribute_used	2004-01-12 23:30:29.000000000 -0800
+++ 25-akpm/include/linux/moduleparam.h	2004-01-12 23:30:29.000000000 -0800
@@ -52,6 +52,7 @@ struct kparam_array
 #define __module_param_call(prefix, name, set, get, arg, perm)		\
 	static char __param_str_##name[] __initdata = prefix #name;	\
 	static struct kernel_param const __param_##name			\
+	__attribute_used__						\
     __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \
 	= { __param_str_##name, perm, set, get, arg }
 
diff -puN scripts/modpost.c~gcc-3_4-needs-attribute_used scripts/modpost.c
--- 25/scripts/modpost.c~gcc-3_4-needs-attribute_used	2004-01-12 23:52:08.000000000 -0800
+++ 25-akpm/scripts/modpost.c	2004-01-12 23:52:20.000000000 -0800
@@ -446,6 +446,7 @@ add_versions(struct buffer *b, struct mo
 
 	buf_printf(b, "\n");
 	buf_printf(b, "static const struct modversion_info ____versions[]\n");
+	buf_printf(b, "__attribute_used__\n");
 	buf_printf(b, "__attribute__((section(\"__versions\"))) = {\n");
 
 	for (s = mod->unres; s; s = s->next) {

_
