This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Force specified function to be linked to a specified lib whencompiling/linking
On 07/21/2017 06:34 PM, Yubin Ruan wrote:
> In addition, when playing with the --wrap=symbol flag, I use nm to inspect
> into the generated .so file and see that there are something like
> open@GLIBC2.6. I believe that reference to the standard `open' call and I
> think if we can find a reliable way to replace the orignal reference that is
> linked to the wrong place with something like that, the same thing can be
> achieved. Do you have any idea how to do that?
You cannot replace any references in an already generated DSO without a special
ELF editor.
The dynamic loader allows you to interpose (replace at runtime) the reference
if you provide a definition that is earlier in the search tree than the one
that is normally used e.g. usg LD_PRELOAD.
--
Cheers,
Carlos.