I'm working on compiling a kernel and I'm having an issue in a header file. The error is nonsensical and I can't figure it out.
The offending few lines are :
#if defined(CONFIG_FRAME_POINTER) && !defined(CONFIG_ARM_UNWIND)
/*
* return_address uses walk_stackframe to do it's work. If both
* CONFIG_FRAME_POINTER=y and CONFIG_ARM_UNWIND=y walk_stackframe uses
unwind
* information. For this to work in the function tracer many functions
would
* have to be marked with __notrace. So for now just depend on
* !CONFIG_ARM_UNWIND.
*/
void *return_address(unsigned int);
#else
extern inline void *return_address(unsigned int level)
{ //<--Line 49
return NULL;
}
#endif
#define ftrace_return_address(n) return_address(n)
The error is :
init/do_mounts_initrd.o: In function `return_address':
/home/name/rpl-enabled-kernel/./arch/arm/include/asm/ftrace.h:49:
multiple definition of `return_address'
init/do_mounts.o:/home/name/rpl-enabled-
kernel/./arch/arm/include/asm/ftrace.h:49: first defined here
Line 49 being the open bracket. I don't really understand the error, but it seems to be suggesting that return_address
can't be defined where it is because it's already defined (which has a lot of stackoverflow solutions), however the line it's pointing to to say it's already defined is where the definition takes place.
Is it somehow defining itself twice? Is it possible the header is included twice somewhere?
Edit: being declared as extern was not the issue, however it appears to have contributed to the issue. The function was multiply defined (based on some pre-processor ifs and such), and removing the extern keyword allowed the compiler to point to the actual source of the error.