develop a 'customized ld'
sean yang
seanatpurdue@hotmail.com
Sun Sep 11 07:41:00 GMT 2005
>From: Ian Lance Taylor <ian@airs.com>
>To: "sean yang" <seanatpurdue@hotmail.com>
>CC: binutils@sourceware.org
>Subject: Re: develop a 'customized ld'
>Date: 10 Sep 2005 22:31:38 -0700
>
>"sean yang" <seanatpurdue@hotmail.com> writes:
>
> > > > You can use a gcc extension creatively to approximate this:
> > > >
> > > > void foo ()
> > > > {
> > > > lab:
> > > > printf ("%p\n", &&lab);
> > > > }
> > >
> > >But be careful with it - recent versions of GCC are pretty bad about
> > >preserving the addresses of labels not used for control flow. I assume
> > >Ian's example will be OK, but if you don't have a computed goto which
> > >might target the label, GCC may just put it somewhere else...
> > Thanks to both of you. This is one conern, the other is I really don't
> > want to have extra intruction--if the programming load for
> > modification the binutils is not too heavy. Perticularly, I don't want
> > to have printf() in the final code. Could u give some more suggestion
> > on this?
>
>The printf was just an example of using the label. The gcc extension
>is '&&' applied to a label. See the gcc docs.
>
>You haven't really said what you want to do with the address. If you
>don't want to use it in the program itself, then this approach is
>useless.
I would like to collect the information of call to some libc functions. I am
not going to use it in the program itself but I am going to use it in a
system tool to watch the program's special calls.
Thanks,
Sean
>
>Ian
_________________________________________________________________
Is your PC infected? Get a FREE online computer virus scan from McAfee®
Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
More information about the Binutils
mailing list