Weak symbols not found by loaded code

Patrick Gauvin pggauvin at gmail.com
Tue May 10 06:56:02 UTC 2016


Hello,

I stumbled across this while trying to load C++ code using libdl. If a
symbol is weakly defined in the base image and used in the loaded
code, the loaded code is unable to find it. It is my understanding
that if there is not a globally exported version of the symbol, the
weak version will be globally available. Is this correct? Or is there
a special procedure I need to use for this situation?

I made a test case in pure C and I see the same behavior. If the
symbol is weak and only present in the base image, it is not found and
left unresolved. However, if the weak symbol is overrode by a symbol
in the loaded code (weak or not), the symbol is resolved and the
loaded code works. I can provide the test source if requested, I'm
just out of time for tonight.

Thank you,

-Patrick


More information about the users mailing list