help-gplusplus
[Top][All Lists]
Advanced

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

Re: shared library linking mystery


From: Bernd Strieder
Subject: Re: shared library linking mystery
Date: Tue, 17 Apr 2007 19:02:50 +0200
User-agent: KNode/0.10.4

Hello,

Ulrich Lauther wrote:

> So, what is the difference between a call to foo() and taking its
> address, from the linkers point of view?

There is lazy binding for function symbols by default, i.e. without an
actual call the symbol will not be resolved. See man ld.so/dlopen....
Somehow taking the address of a function causes the symbol being
resolved at loading time, instead. This is what is observable.

It is mentioned in the man pages that there is never lazy binding for
variables. Lazy binding of functions could be done by some intermediate
function overwriting its own entry in a table. This trick won't work
for variables, and function pointers, without using extra function
calls for the indirection, where no function call should be in the
code.

I think you can observe all this using objdump -r/-R?

Bernd Strieder


reply via email to

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