Signed-off-by: Paolo 'Blaisorblade' Giarrusso --- um-linux-2.4.27-paolo/arch/um/include/init.h | 56 +++++++++++++++++---------- 1 files changed, 37 insertions(+), 19 deletions(-) diff -puN arch/um/include/init.h~uml-use-__used__-attrib arch/um/include/init.h --- um-linux-2.4.27/arch/um/include/init.h~uml-use-__used__-attrib 2005-04-15 11:12:49.000000000 +0200 +++ um-linux-2.4.27-paolo/arch/um/include/init.h 2005-04-15 11:12:49.000000000 +0200 @@ -37,12 +37,40 @@ */ #ifndef _LINUX_INIT_H +#ifndef __LINUX_COMPILER_H + +#undef __attribute_used__ +#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 */ + typedef int (*initcall_t)(void); typedef void (*exitcall_t)(void); #define __init __attribute__ ((__section__ (".text.init"))) -#define __exit __attribute__ ((unused, __section__(".text.exit"))) +#define __exit __attribute_used__ __attribute__ ((__section__(".text.exit"))) #define __initdata __attribute__ ((__section__ (".data.init"))) +#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"))) + +#define __initcall(fn) \ + static initcall_t __initcall_##fn __attribute_used__ __init_call = fn +#define __exitcall(fn) \ + static exitcall_t __exitcall_##fn __exit_call = fn #endif @@ -58,15 +86,15 @@ extern const char *__uml_help_start, *__ #endif #define __uml_initcall(fn) \ - static initcall_t __uml_initcall_##fn __uml_init_call = fn + static initcall_t __uml_initcall_##fn __attribute_used__ __uml_init_call = fn #define __uml_exitcall(fn) \ - static exitcall_t __uml_exitcall_##fn __uml_exit_call = fn + static exitcall_t __uml_exitcall_##fn __attribute_used__ __uml_exit_call = fn extern struct uml_param __uml_setup_start, __uml_setup_end; #define __uml_postsetup(fn) \ - static initcall_t __uml_postsetup_##fn __uml_postsetup_call = fn + static initcall_t __uml_postsetup_##fn __attribute_used__ __uml_postsetup_call = fn #define __non_empty_string(dummyname,string) \ struct __uml_non_empty_string_struct_##dummyname \ @@ -94,21 +122,11 @@ extern struct uml_param __uml_setup_star * Mark functions and data as being only used at initialization * or exit time. */ -#define __uml_init_setup __attribute__ ((unused,__section__ (".uml.setup.init"))) -#define __uml_setup_help __attribute__ ((unused,__section__ (".uml.help.init"))) -#define __uml_init_call __attribute__ ((unused,__section__ (".uml.initcall.init"))) -#define __uml_postsetup_call __attribute__ ((unused,__section__ (".uml.postsetup.init"))) -#define __uml_exit_call __attribute__ ((unused,__section__ (".uml.exitcall.exit"))) - -#ifndef __KERNEL__ - -#define __initcall(fn) static initcall_t __initcall_##fn __init_call = fn -#define __exitcall(fn) static exitcall_t __exitcall_##fn __exit_call = fn - -#define __init_call __attribute__ ((unused,__section__ (".initcall.init"))) -#define __exit_call __attribute__ ((unused,__section__ (".exitcall.exit"))) - -#endif +#define __uml_init_setup __attribute_used__ __attribute__ ((__section__ (".uml.setup.init"))) +#define __uml_setup_help __attribute_used__ __attribute__ ((__section__ (".uml.help.init"))) +#define __uml_init_call __attribute_used__ __attribute__ ((__section__ (".uml.initcall.init"))) +#define __uml_postsetup_call __attribute_used__ __attribute__ ((__section__ (".uml.postsetup.init"))) +#define __uml_exit_call __attribute_used__ __attribute__ ((__section__ (".uml.exitcall.exit"))) #endif /* _LINUX_UML_INIT_H */ _