Why is our symbol lookup the way it is?

Joe Marcus Clarke marcus at FreeBSD.org
Wed Sep 7 10:31:49 PDT 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Alexander Kabaev wrote:
| On Wed, Sep 07, 2005 at 02:06:44AM -0400, Joe Marcus Clarke wrote:
|
|>This is something that's been bothering me for a while, ever since I
|>fixed the symbol conflicts in Mozilla with -Bsymbolic.  Why do we not
|>look in the referencing object first by default?  I'm referring to the
|>great comments in the symlook_default() function in rtld.c.  We only
|>check the referencing object first when -Bsymbolic is passed to the
|>linker.
|
|
| Number of reasons. Programs should be able to override symbols from
| dynamim libraries, for instance. C++ exceptions won't work with -Bsymbolic
| when exceptions are thrown across shared library boundaries, as thrower
| and hander will use their own typeinfo structures and the catch clause
| in handler block will simply not recognize the exception, etc.

Thanks for the explanation.

|
|
|>The main reason I'm asking is that I just tracked down another symbol
|>conflict in a dlopen'd library that plagues us but not Linux.  I assume
|>there was a good reason for resolving symbols in the order we do, but
|>admittedly, I don't understand enough of the linker to know what it is.
|>Thanks.
|
|
| I would suggest providing an exect scenario that is biting you. I fixed
| most incompatibilities in symbol lookup order between us and Linux for
| when Martin Blapp was working on initial OpenOffice port and if there
| is another, I would like to know about it.

The problems are generally the same, but this latest problem breaks down
like this.  GTK+ uses theme engines to create certain widgets.  These
theme engines are just shared objects.  The GNOME Theme Manager dlopens
all of these shared objects at the same time in order to generate
thumbnails of all available themes.

Three of these engines define a non-static symbol, is_combo_box(), that
accepts two arguments, a GtkWidget* and a gboolean (typedef int).
However, one engine declares a non-static is_combo_box() symbol that
accepts only one argument, a GtkWidget*.  When asked to resolve
is_combo_box in the Smooth engine (one that declares the two-argument
function), it finds the is_combo_box symbol in the Clearlooks engine
(the one that declares the one-argument symbol), and GNOME Theme Manager
crashes.

My solution was to rename the offending symbol in the Clearlooks engine.
~ This is not ideal, but it works, and I will certainly report the bug to
the authors, but apparently Linux does not have this problem.

Joe

|
| --
| Alexander Kabaev
|


- --
Joe Marcus Clarke
FreeBSD GNOME Team	::	gnome at FreeBSD.org
FreeNode / #freebsd-gnome
http://www.FreeBSD.org/gnome
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (Darwin)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDHyQqb2iPiv4Uz4cRAvVKAJ9YcAI8CNWTtImWJd1viUPtHLBHygCfXaWs
eSWbONDR403I0vJy69G+7Rw=
=0Nm2
-----END PGP SIGNATURE-----


More information about the freebsd-hackers mailing list