After reading these questions, I'm looking for some more detail about how to control symbol resolution order.
In my problem, I have main executable exec
. exec
dynamically links to a.so
and c.so
. a.so
dynamically links to b.so
. b.so
calls function foo
, which is normally provided by c.so
but in this case is also provided by exec
. b.so
only works with c.so
's implementation of foo
.
A diagram of the situation:
exec (foo caller and provider)
| \
a.so |
| |
b.so | (foo caller)
| /
c.so (foo provider)
I can only control the compilation/source of a.so
, and I link a.so
to exec
with LD_PRELOAD
.
I'd like calls to foo
in exec
to resolve to exec
's implementation, and calls in b.so
to resolve to c.so
's implementation. Is this type of thing with different symbol lookups in different objects possible?