summaryrefslogtreecommitdiff
path: root/packages/linux/unslung-kernel/linux-2.4.24-attribute-used.patch
blob: bcf1c103356a2ce84fa8c04336951d9556ed11ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
diff -purN linux-2.4.24-uc0.orig/include/asm-arm/setup.h linux-2.4.24-uc0/include/asm-arm/setup.h
--- linux-2.4.24-uc0.orig/include/asm-arm/setup.h	2003-08-25 04:44:43.000000000 -0700
+++ linux-2.4.24-uc0/include/asm-arm/setup.h	2004-09-09 04:36:03.000000000 -0700
@@ -236,7 +236,7 @@ struct tagtable {
 	int (*parse)(const struct tag *);
 };
 
-#define __tag __attribute__((unused, __section__(".taglist")))
+#define __tag __attribute_used__ __attribute__((__section__(".taglist")))
 #define __tagtable(tag, fn) \
 static struct tagtable __tagtable_##fn __tag = { tag, fn }
 
diff -purN linux-2.4.24-uc0.orig/include/linux/compiler.h linux-2.4.24-uc0/include/linux/compiler.h
--- linux-2.4.24-uc0.orig/include/linux/compiler.h	2004-03-31 21:52:49.000000000 -0800
+++ linux-2.4.24-uc0/include/linux/compiler.h	2004-09-09 01:33:29.000000000 -0700
@@ -13,4 +13,18 @@
 #define likely(x)	__builtin_expect((x),1)
 #define unlikely(x)	__builtin_expect((x),0)
 
+#if __GNUC__ > 3
+#define __attribute_used__     __attribute__((__used__))
+#elif __GNUC__ == 3
+#if  __GNUC_MINOR__ >= 3
+# define __attribute_used__    __attribute__((__used__))
+#else
+# define __attribute_used__    __attribute__((__unused__))
+#endif /* __GNUC_MINOR__ >= 3 */
+#elif __GNUC__ == 2
+#define __attribute_used__     __attribute__((__unused__))
+#else
+#define __attribute_used__     /* not implemented */
+#endif /* __GNUC__ */
+
 #endif /* __LINUX_COMPILER_H */
diff -purN linux-2.4.24-uc0.orig/include/linux/init.h linux-2.4.24-uc0/include/linux/init.h
--- linux-2.4.24-uc0.orig/include/linux/init.h	2004-03-31 21:52:50.000000000 -0800
+++ linux-2.4.24-uc0/include/linux/init.h	2004-09-09 01:38:11.000000000 -0700
@@ -2,6 +2,7 @@
 #define _LINUX_INIT_H
 
 #include <linux/config.h>
+#include <linux/compiler.h>
 
 /* These macros are used to mark some functions or 
  * initialized data (doesn't apply to uninitialized data)
@@ -51,7 +52,7 @@ typedef void (*exitcall_t)(void);
 extern initcall_t __initcall_start, __initcall_end;
 
 #define __initcall(fn)								\
-	static initcall_t __initcall_##fn __init_call = fn
+	static initcall_t __initcall_##fn __attribute_used__ __init_call = fn
 #define __exitcall(fn)								\
 	static exitcall_t __exitcall_##fn __exit_call = fn
 
@@ -67,7 +68,7 @@ extern struct kernel_param __setup_start
 
 #define __setup(str, fn)								\
 	static char __setup_str_##fn[] __initdata = str;				\
-	static struct kernel_param __setup_##fn __attribute__((unused)) __initsetup = { __setup_str_##fn, fn }
+	static struct kernel_param __setup_##fn __attribute_used__ __initsetup = { __setup_str_##fn, fn }
 
 #endif /* __ASSEMBLY__ */
 
@@ -77,16 +78,16 @@ extern struct kernel_param __setup_start
  */
 #ifndef NO_TEXT_SECTIONS
 #define __init		__attribute__ ((__section__ (".text.init")))
-#define __exit		__attribute__ ((unused, __section__(".text.exit")))
+#define __exit		__attribute_used__ __attribute__ ((__section__(".text.exit")))
 #else
 #define __init
-#define __exit		__attribute__ ((unused))
+#define __exit		__attribute_used__
 #endif
 #define __initdata	__attribute__ ((__section__ (".data.init")))
-#define __exitdata	__attribute__ ((unused, __section__ (".data.exit")))
-#define __initsetup	__attribute__ ((unused,__section__ (".setup.init")))
-#define __init_call	__attribute__ ((unused,__section__ (".initcall.init")))
-#define __exit_call	__attribute__ ((unused,__section__ (".exitcall.exit")))
+#define __exitdata	__attribute_used__ __attribute__ ((__section__ (".data.exit")))
+#define __initsetup	__attribute_used__ __attribute__ ((__section__ (".setup.init")))
+#define __init_call	__attribute_used__ __attribute__ ((__section__ (".initcall.init")))
+#define __exit_call	__attribute_used__ __attribute__ ((__section__ (".exitcall.exit")))
 
 /* For assembly routines */
 #define __INIT		.section	".text.init","ax"
diff -purN linux-2.4.24-uc0.orig/include/linux/module.h linux-2.4.24-uc0/include/linux/module.h
--- linux-2.4.24-uc0.orig/include/linux/module.h	2002-08-02 17:39:45.000000000 -0700
+++ linux-2.4.24-uc0/include/linux/module.h	2004-09-09 03:15:30.000000000 -0700
@@ -8,6 +8,7 @@
 #define _LINUX_MODULE_H
 
 #include <linux/config.h>
+#include <linux/compiler.h>
 #include <linux/spinlock.h>
 #include <linux/list.h>
 
@@ -254,9 +255,9 @@ __attribute__((section(".modinfo"))) =		
  */
 #define MODULE_GENERIC_TABLE(gtype,name)	\
 static const unsigned long __module_##gtype##_size \
-  __attribute__ ((unused)) = sizeof(struct gtype##_id); \
+  __attribute_used__ = sizeof(struct gtype##_id); \
 static const struct gtype##_id * __module_##gtype##_table \
-  __attribute__ ((unused)) = name
+  __attribute_used__ = name
 
 /*
  * The following license idents are currently accepted as indicating free
@@ -284,7 +285,7 @@ static const struct gtype##_id * __modul
  */
  
 #define MODULE_LICENSE(license) 	\
-static const char __module_license[] __attribute__((section(".modinfo"))) =   \
+static const char __module_license[] __attribute_used__ __attribute__((section(".modinfo"))) =   \
 "license=" license
 
 /* Define the module variable, and usage macros.  */
@@ -296,10 +297,10 @@ extern struct module __this_module;
 #define MOD_IN_USE		__MOD_IN_USE(THIS_MODULE)
 
 #include <linux/version.h>
-static const char __module_kernel_version[] __attribute__((section(".modinfo"))) =
+static const char __module_kernel_version[] __attribute_used__ __attribute__((section(".modinfo"))) =
 "kernel_version=" UTS_RELEASE;
 #ifdef MODVERSIONS
-static const char __module_using_checksums[] __attribute__((section(".modinfo"))) =
+static const char __module_using_checksums[] __attribute_used__ __attribute__((section(".modinfo"))) =
 "using_checksums=1";
 #endif
 
@@ -319,7 +320,7 @@ static const char __module_using_checksu
  */
 #define MODULE_GENERIC_TABLE(gtype,name) \
 static const struct gtype##_id * __module_##gtype##_table \
-  __attribute__ ((unused, __section__(".data.exit"))) = name
+  __attribute_used__ __attribute__ ((__section__(".data.exit"))) = name
 
 #ifndef __GENKSYMS__