develop a 'customized ld'

sean yang seanatpurdue@hotmail.com
Sat Sep 10 17:16:00 GMT 2005


Hi folks,
I am looking at the source codes in ld directory(source code related to the 
linker) as I want to develop a slightly different linker. Basically, what I 
want to do is to find the address of some instructions in a program at link 
time.

For example, I want to find the program counter(i.e., the address of the 
instruction) of "call '@foo'" instruction at link time.
#demo.c
extern int foo(int);
int main(){
  int i, j;
  i=foo(1); //which will be compiled to something like "push 1; call 
@foo;..."
  j=foo(i);
}//the assebly code is not syntatically correct--only try to show my goal.

Conceptually, this doesn't seem to need much code modification---keep most 
pass intact and add a customized pass to achieve what i want. ld is a quite 
big project to me, honestly. And this is my first time to touch it. Could 
someone give me some hint where should I start? Can any expert assess the 
difficulty of achieving such functionality?

Thanks,
Sean

_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar – get it now! 
http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/



More information about the Binutils mailing list