Address of return address

Segher Boessenkool segher@kernel.crashing.org
Fri Jul 6 10:58:00 GMT 2018


On Fri, Jul 06, 2018 at 05:46:11AM +0000, Mahmood Naderan via gcc-help wrote:
> The C function __builtin_return_address(0) is able to return the "return address" and that is a hex value. How can I get the address of "return address"? I mean the memory location which holds the return address. 

You cannot.  There _is_ no such memory location, in the general case (many
architectures use an LR or RA register to hold the return address, for
example).

> It seems that &__builtin_return_address(0) is invalid.

It is.


Segher



More information about the Gcc-help mailing list