Question about return_address()

H Hartley Sweeten hartleys at visionengravers.com
Thu Apr 12 13:37:14 EDT 2012


Hello all,

I have a question about the return_address() function.

In arch/arm/include/asm/ftrace.h we have this (comment removed):


#if defined(CONFIG_FRAME_POINTER) && !defined(CONFIG_ARM_UNWIND)

void *return_address(unsigned int);

#else

extern inline void *return_address(unsigned int level)
{
	return NULL;
}

#endif


And in arch/arm/kernel/return_address.c we have this (only relevant
parts):


#include <linux/ftrace.h>

#if defined(CONFIG_FRAME_POINTER) && !defined(CONFIG_ARM_UNWIND)

void *return_address(unsigned int level)
{
	...
}

#else /* if defined(CONFIG_FRAME_POINTER) && !defined(CONFIG_ARM_UNWIND) */

#if defined(CONFIG_ARM_UNWIND)
#warning "TODO: return_address should use unwind tables"
#endif

void *return_address(unsigned int level)
{
	return NULL;
}

#endif /* if defined(CONFIG_FRAME_POINTER) && !defined(CONFIG_ARM_UNWIND) / else */

EXPORT_SYMBOL_GPL(return_address);


It appears that when CONFIG_FRAME_POINTER is set and CONFIG_ARM_UNWIND
is not the function is declared twice, once as an inline in the header and again as an
exported function in the source.

Is this a problem which should be fixed?

Right now it's producing a sparse warning:

	warning: symbol 'return_address' was not declared. Should it be static?

Regards,
Hartley




More information about the linux-arm-kernel mailing list