Problem using --wrap flag with stat/lstat functions

Ian Lance Taylor ian@wasabisystems.com
Tue Feb 10 21:37:00 GMT 2004


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



More information about the Binutils mailing list