This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: KDE: C++ and shared libraries

On Fri, Sep 21, 2001 at 12:35:16PM -0400, Leon Bottou wrote:
> The correct solution would be to generate the shared objects 
> using  the ld option "--retain-symbols-file" to specify a list of exported symbols.

Or local *; default in version script.
There are 2 problems with this: the linkonce objects are linkonce usually
because C++ semantics requires it, so making them private to shared
libraries may be not compatible with C++ (think e.g. about static variables
in inline functions etc.). Also, when you have the same linkonce routine in
a bunch of shared libraries, it not only wases a lot of memory, but adds
runtime relocs too (think about .got relocations function calls it makes,
etc.). The -flinkonce-accross-libs stuff would not be IMHO overly hard to
use, if you look at how much a typical large C++ library removes linkonce
symbols, you'll notice it is not that common (e.g. both libkdeui and libqt
lost one single linkonce symbol within a year).
I'll say more once I implement this and do some statistics.

> There are two ways to implement this 
> - The relevant linkonce section could bear a flag  (SHF_NO_EXPORT)
>   specifying that the global symbols defined in this section should
>   not be exported from shared objects.
> - There could be a new symbol binding type  STB_GLOBAL_NO_EXPORT
>   specifying that this symbol is global for linking purposes but should
>   not be exported from shared objects.

You mean STV_HIDDEN, right?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]