Documenting the (dynamic) linking rules for symbol versioning

Florian Weimer fweimer@redhat.com
Thu Apr 20 13:01:00 GMT 2017


On 04/20/2017 02:58 PM, Siddhesh Poyarekar wrote:
> On Thursday 20 April 2017 06:10 PM, Michael Kerrisk (man-pages) wrote:
>> I think that I have failed to provide enough detail for
>> you to understand what I meant. Consider the following:
>>
>> 1. We want to interpose some symbol in glibc (say, "malloc@GLIBC_2.0")
>>     with a symbol of our own (perhaps via a preloaded library).
>> 2. In our preloaded shared library, the interposing "malloc"
>>     need not be a versioned symbol.
>>
>> At least
> 
> Ah ok, got it.  The dlsym will result in picking up the latest symbol.
> 
>> Note the last line: dlsym() found xyz@@VER_2 (not xyz@VER_3).
> 
> Hmm interesting, I thought 'latest' would imply the last version in the
> sequence of versions in the map, but I guess it kinda makes sense that
> it is the @@ default, similar to how a static linker would pick it up.

It might be another instance of bug 12977.  At least its fix will 
involve preferring the default version in this case.  I don't know what 
to do if there is no default version.  We currently do not perform a 
topological sort on the version graph to find the maximum version.

Florian



More information about the Libc-alpha mailing list