develop a 'customized ld'

Ian Lance Taylor ian@airs.com
Sat Sep 10 19:04:00 GMT 2005


Simon Richter <Simon.Richter@hogyros.de> writes:

> sean yang wrote:
> 
> > For example, I want to find the program counter(i.e., the address of the 
> > instruction) of "call '@foo'" instruction at link time.
> 
> This can be done for assembler code, but obvoisly not for C code as
> there is no way to make sure the C compiler will always use the same
> instructions. Just declare an assembler label in front of the
> instruction of which you want to take the address.

You can use a gcc extension creatively to approximate this:

void foo ()
{
 lab:
  printf ("%p\n", &&lab);
}

Ian



More information about the Binutils mailing list