From 7602d24973c896f3d5070d96e8c19377d6e25c36 Mon Sep 17 00:00:00 2001 From: Olaf Hering Date: Sun, 7 Nov 2004 04:11:09 -0800 Subject: [PATCH] fix initcall_debug on ppc64/ia64 ia64 and ppc64 have function descriptors. Booting with initcall_debug will print the descriptor address, not the address and name of the actual function. Another indirection is required. Tested on ppc, ppc64 and ia64. Signed-off-by: Olaf Hering Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/linux/kallsyms.h | 10 ++++++++++ init/main.c | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/include/linux/kallsyms.h b/include/linux/kallsyms.h index 1a5dce8f9346..9bbd04092365 100644 --- a/include/linux/kallsyms.h +++ b/include/linux/kallsyms.h @@ -47,6 +47,16 @@ __attribute__((format(printf,1,2))); static inline void __check_printsym_format(const char *fmt, ...) { } +/* ia64 and ppc64 use function descriptors, which contain the real address */ +#if defined(CONFIG_IA64) || defined(CONFIG_PPC64) +#define print_fn_descriptor_symbol(fmt, addr) \ +do { \ + unsigned long *__faddr = (unsigned long*) addr; \ + print_symbol(fmt, __faddr[0]); \ +} while (0) +#else +#define print_fn_descriptor_symbol(fmt, addr) print_symbol(fmt, addr) +#endif #define print_symbol(fmt, addr) \ do { \ diff --git a/init/main.c b/init/main.c index 4b20c9303bd4..ecc39fafe51c 100644 --- a/init/main.c +++ b/init/main.c @@ -604,7 +604,7 @@ static void __init do_initcalls(void) if (initcall_debug) { printk(KERN_DEBUG "Calling initcall 0x%p", *call); - print_symbol(": %s()", (unsigned long) *call); + print_fn_descriptor_symbol(": %s()", (unsigned long) *call); printk("\n"); } -- cgit v1.2.3