summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Morton <akpm@osdl.org>2004-01-19 05:13:24 -0800
committerLinus Torvalds <torvalds@home.osdl.org>2004-01-19 05:13:24 -0800
commitfd2ac4b289d00952ee14782ed5d282dcb0191a6c (patch)
treea9c0da134100a02463a9f9537fb60860087ec213
parentce65cade5848263c483eda1b7ffe9ed5a01a0c8f (diff)
[PATCH] make gcc 3.4 compilation work
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).
-rw-r--r--include/linux/module.h3
-rw-r--r--include/linux/moduleparam.h1
-rw-r--r--scripts/modpost.c1
3 files changed, 5 insertions, 0 deletions
diff --git a/include/linux/module.h b/include/linux/module.h
index 13ff244afdbf..c0418e47a296 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -60,6 +60,7 @@ search_extable(const struct exception_table_entry *first,
#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 *symbol);
#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 *symbol);
__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 --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
index 0a5becbed774..cbca00722b5c 100644
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -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 --git a/scripts/modpost.c b/scripts/modpost.c
index 0b6d7dfffab6..7e6a4bb035a7 100644
--- a/scripts/modpost.c
+++ b/scripts/modpost.c
@@ -446,6 +446,7 @@ add_versions(struct buffer *b, struct module *mod)
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) {