help-gplusplus
[Top][All Lists]
Advanced

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

Having the GNU linker *not* remove unused symbols...


From: Carsten Fuchs
Subject: Having the GNU linker *not* remove unused symbols...
Date: Fri, 07 Apr 2006 10:21:39 +0200
User-agent: Debian Thunderbird 1.0.2 (X11/20050817)

Hello all,

I've written an executable and a .so shared library, and the executable dlopen()s the shared library during runtime.

The executable has been linked with
    g++ ... -lcfsLib -Wl,-rpath,. -Wl,--export-dynamic

where the libcfsLib.a contains symbols that are supposed to be referenced by the dlopen()ed shared library later.

However, my call to dlopen() returns with an error message about an undefined symbol that I would have expected to be provided by libcfsLib.a.


I guess what happens is that when the linker links the executable, it removes all symbols from libcfsLib.a that are unused by the executable. As a consequence, when dlopen() is called with the shared object that needs the previously removed symbol in the executable, it is not found. grep'ing the output of nm for the executable doesn't list the missing symbol either.

Thus, is there a way to make the linker *not* remove some or all unused symbols somehow? Isn't that the supposed purpose of the --export-dynamic parameter?

Thank you very much, and best regards,
Carsten


reply via email to

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