This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: how to access PC


On Mon, Sep 08, 2003 at 06:26:34PM -0700, Andrew Pinski wrote:
> Try this function:
> void * __attribute__((noinline)) getpc()
> {
> 	void *t;
> 	asm("mflr %0":"=r"(t));
> 	return t;
> }

If you're not going to inline, __builtin_return_address(0) will work.


r~


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]