This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Problem using --wrap flag with stat/lstat functions
- From: Ian Lance Taylor <ian at wasabisystems dot com>
- To: Daniel Sumers Myers <dmyers at umiacs dot umd dot edu>
- Cc: binutils at sources dot redhat dot com
- Date: 10 Feb 2004 16:36:58 -0500
- Subject: Re: Problem using --wrap flag with stat/lstat functions
- References: <20040210213315.GC1928@lysine.umiacs.umd.edu>
Daniel Sumers Myers <dmyers@umiacs.umd.edu> writes:
> I'm having a problem using the --wrap flag of ld to provide a wrapper for the
> GNU libc's stat and lstat functions. In C, everything works nicely, but in optimized
> C++ code, the compiler inlines stat and lstat, and my wrappers no longer get called.
> Short of providing wrappers for the functions called by the inlined stat and lstat,
> is there a way around this problem?
No, not really. Once the compiler has decided to inline stat, there
isn't anything there that the linker can latch onto. I suppose you
could try using the -fno-inline option when compiling, but that would
certainly hurt the performance of your C++ code.
Ian