Solving symbols from different shared objects?

Han Shen
Wed Sep 21 01:29:00 GMT 2016

Hi Cary, we are testing trunk binutils and found lots of failures, one
scenario (unresolved reference to "dlsym") is linking an executable
that involves 3 shared libraries,, and

In, there is an undefined, un-versioned "dlsym"
In, there is an undefined, versioned "dlsym@@GLIBC_2.2.5"
In, there is the definition for "dlsym@@GLIBC_2.2.5".

The old binutils (forked at the end of 2014), which we are now using,
solves dlsym in using definition in in

However, in fixing the bug -
Symbol_table::define_default_version is modified, so that definition
in no longer applies to, the rationale being (quote from
comment) "if two symbols are from different objects, they are
different symbols."

To fix the problem, I modified it so that "if two symbols are from
different objects, *and both of them are defined*, they are different
symbols.", as the patch illustrates below -

diff --git a/gold/ b/gold/
index b31794a..cdeef7f 100644
--- a/gold/
+++ b/gold/
@@ -881,7 +881,7 @@
Symbol_table::define_default_version(Sized_symbol<size>* sym,
               && sym->is_from_dynobj())
       else if (pdef->second->is_from_dynobj()
-              && sym->is_from_dynobj()
+              && sym->is_from_dynobj() && pdef->second->is_defined()
               && pdef->second->object() != sym->object())

Do you think this is a a reasonable fix?


More information about the Binutils mailing list