4.7.6. __builtin_return_address

This builtin function returns the return address of the current function.

Note

This builtin function is a GNU compiler extension that is supported by the ARM compiler.

Mode

Supported in GNU mode only.

Syntax

void *__builtin_return_address(unsigned int val)

Where:

val

is an unsigned integer evaluating to zero.

Return value

__builtin_return_address returns the value of the link register that is used in returning from the current function.

Example

void *return_address_(void)
{
    static void *rtn_addr;
    rtn_addr = __builtin_return_address(0); // return the lr
    return rtn_addr;
}

See also

Copyright © 2007, 2010 ARM Limited. All rights reserved.ARM DUI 0348A
Non-Confidential