Commit fd2ac4b2 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[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).
parent ce65cade
...@@ -60,6 +60,7 @@ search_extable(const struct exception_table_entry *first, ...@@ -60,6 +60,7 @@ search_extable(const struct exception_table_entry *first,
#define __module_cat(a,b) ___module_cat(a,b) #define __module_cat(a,b) ___module_cat(a,b)
#define __MODULE_INFO(tag, name, info) \ #define __MODULE_INFO(tag, name, info) \
static const char __module_cat(name,__LINE__)[] \ static const char __module_cat(name,__LINE__)[] \
__attribute_used__ \
__attribute__((section(".modinfo"),unused)) = __stringify(tag) "=" info __attribute__((section(".modinfo"),unused)) = __stringify(tag) "=" info
#define MODULE_GENERIC_TABLE(gtype,name) \ #define MODULE_GENERIC_TABLE(gtype,name) \
...@@ -142,6 +143,7 @@ void *__symbol_get_gpl(const char *symbol); ...@@ -142,6 +143,7 @@ void *__symbol_get_gpl(const char *symbol);
#define __CRC_SYMBOL(sym, sec) \ #define __CRC_SYMBOL(sym, sec) \
extern void *__crc_##sym __attribute__((weak)); \ extern void *__crc_##sym __attribute__((weak)); \
static const unsigned long __kcrctab_##sym \ static const unsigned long __kcrctab_##sym \
__attribute_used__ \
__attribute__((section("__kcrctab" sec), unused)) \ __attribute__((section("__kcrctab" sec), unused)) \
= (unsigned long) &__crc_##sym; = (unsigned long) &__crc_##sym;
#else #else
...@@ -155,6 +157,7 @@ void *__symbol_get_gpl(const char *symbol); ...@@ -155,6 +157,7 @@ void *__symbol_get_gpl(const char *symbol);
__attribute__((section("__ksymtab_strings"))) \ __attribute__((section("__ksymtab_strings"))) \
= MODULE_SYMBOL_PREFIX #sym; \ = MODULE_SYMBOL_PREFIX #sym; \
static const struct kernel_symbol __ksymtab_##sym \ static const struct kernel_symbol __ksymtab_##sym \
__attribute_used__ \
__attribute__((section("__ksymtab" sec), unused)) \ __attribute__((section("__ksymtab" sec), unused)) \
= { (unsigned long)&sym, __kstrtab_##sym } = { (unsigned long)&sym, __kstrtab_##sym }
......
...@@ -52,6 +52,7 @@ struct kparam_array ...@@ -52,6 +52,7 @@ struct kparam_array
#define __module_param_call(prefix, name, set, get, arg, perm) \ #define __module_param_call(prefix, name, set, get, arg, perm) \
static char __param_str_##name[] __initdata = prefix #name; \ static char __param_str_##name[] __initdata = prefix #name; \
static struct kernel_param const __param_##name \ static struct kernel_param const __param_##name \
__attribute_used__ \
__attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \ __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \
= { __param_str_##name, perm, set, get, arg } = { __param_str_##name, perm, set, get, arg }
......
...@@ -446,6 +446,7 @@ add_versions(struct buffer *b, struct module *mod) ...@@ -446,6 +446,7 @@ add_versions(struct buffer *b, struct module *mod)
buf_printf(b, "\n"); buf_printf(b, "\n");
buf_printf(b, "static const struct modversion_info ____versions[]\n"); buf_printf(b, "static const struct modversion_info ____versions[]\n");
buf_printf(b, "__attribute_used__\n");
buf_printf(b, "__attribute__((section(\"__versions\"))) = {\n"); buf_printf(b, "__attribute__((section(\"__versions\"))) = {\n");
for (s = mod->unres; s; s = s->next) { for (s = mod->unres; s; s = s->next) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment