This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils 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: Problem with LD_PRELOAD


On Tue, Mar 19, 2002 at 03:24:45PM -0800, Ian Lance Taylor wrote:
> Manuel Arriaga <m.arriaga@ip.pt> writes:
> 
> > So my question is: why aren't all calls to open() being redirected to the 
> > preloaded object? Why does this redirection only work in some cases? 
> 
> I would guess that cp is not calling open().  strace does not report
> the libc functions called by a program.  It reports the system calls
> called by a program.  I would guess that cp is calling some libc
> function which calls the system call open().  Use objdump -T to see
> which dynamic symbols appear in cp; if open() is not one of them, then
> using LD_PRELOAD will not be able to intercept calls to open().

Also, to override functions in GNU libc, you need to provide versioned
symbols using the same versions as GNU libc uses.  I'd recommend a good
reference on ELF symbol versioning, but I don't know one :)

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer


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