bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug binutils/22360] Wl not wrapping all functions call


From: carlos at redhat dot com
Subject: [Bug binutils/22360] Wl not wrapping all functions call
Date: Sat, 28 Oct 2017 02:14:37 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=22360

Carlos O'Donell <carlos at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |carlos at redhat dot com
          Component|libc                        |binutils
            Product|glibc                       |binutils

--- Comment #1 from Carlos O'Donell <carlos at redhat dot com> ---
Moving this to binutils, since the -wrap behaviour is implemented in the static
linker.

However, you misunderstand the use of the -wrap feature. The feature only wraps
symbol references in the object you are assembling. In this case you are only
ever assembling the main binary, and since you make no calls to clock_gettime
from the binary, there is nothing to wrap.

You cannot use -wrap to wrap calls in the already compiled libstdc++.so.6, to
do that you would have to recompile libstdc++.so.6 with -wrap, and it would
have to include it's own copies of the wrappers.

We are at an X->Y problem here though since you haven't explained what you are
trying to accomplish.

What you *probably* want to use is:

(a) Symbol interposition.
- Define clock_gettime, and interpose the libstdc++.so.6 version, and in your
version use dlopen to get a function pointer to the real clock_gettime and call
that when you're done.

(b) LD_AUDIT interface.
- Write an audit interface module and use it to intercept the resolution of
clock_gettime, and inspect parameters, change parameters, or do anything else
you want.

These two interfaces are *other* ways in which you can dynamically intercept
these calls.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]