This is the mail archive of the
mailing list for the glibc project.
Re: DT_GNU_HASH: ~ 50% dynamic linking improvement
- From: Mike Hearn <mike at plan99 dot net>
- To: libc-alpha at sources dot redhat dot com
- Date: Thu, 13 Jul 2006 21:59:01 +0100
- Subject: Re: DT_GNU_HASH: ~ 50% dynamic linking improvement
- References: <20060628170900.GX3823@sunsite.mff.cuni.cz> <firstname.lastname@example.org> <20060703092534.GC3823@sunsite.mff.cuni.cz>
I was a bit confused by these comments:
On Mon, 03 Jul 2006 11:25:34 +0200, Jakub Jelinek wrote:
> Direct linking is mainly useful for OSes where
> there is one entity controlling the whole thing
I don't understand why you say this. Programs on Windows and MacOS
routinely use libraries and frameworks outside of those provided by
Microsoft/Apple and nothing breaks. Direct linking gives developers the
semantics they expect from shared libraries - it is not intuitive that you
must use symbol versioning, visibility switches etc when building a
library or application to avoid subtle conflicts in future.
This is especially the case as symbol versioning simply moves the problem
around and does not solve the underlying cause of confusion (that symbols
are looked up in global scope).
> If the libraries on the other side are updated independently,
> without one body controlling them all, symbols keep being added and removed
> (for C the latter would be an ABI break, but for C++ the latter often
> happens just when you change the internal implementation of some
> function/method and it no longer references some function/method which suddenly
> does not need to be compiled in) and direct linking just will lead to
> horrible ODR and pointer equality violations that programs will sooner or
> later break on.
Michael Meeks -Bdirect patches use regular scope for vague symbols and
seem to take account of this, they also seem to work for OpenOffice which
must be the largest C++ program we have on Linux. Why is this approach not
> So for direct linking which certainly won't be used for
> all programs, but perhaps just a very limited set, you really should use
> a separate section.
Lack of direct linking has caused much confusion amongst regular
programmers on the street, especially those writing cross platform
software. It is not intuitive to people that (say) a
C++ program that uses libstdc++.so.5 can crash and burn on systems where
Chinese input methods are used due to mis-linked symbols. Windows uses it,
Solaris uses it, I'm pretty sure MacOS X uses it too yet usage of C++ is
very high on these platforms. So how comes it won't work for us?