shared libs without linker scripts?

Andrew Bartlett abartlet at samba.org
Fri Jun 22 19:11:23 MDT 2012


On Fri, 2012-06-22 at 19:34 -0400, simo wrote:
> On Sat, 2012-06-23 at 08:50 +1000, Andrew Bartlett wrote: 
> > On Thu, 2012-06-21 at 22:05 -0400, simo wrote:
> > > On Fri, 2012-06-22 at 08:58 +1000, Andrew Bartlett wrote: 
> > > > On Thu, 2012-06-21 at 14:22 +0200, Jelmer Vernooij wrote:
> > > > 
> > > > > Of course, symbol versioning will help you on Linux, but not all
> > > > > platforms support symbol versioning.
> > > > 
> > > > On this, I'm thinking about the broader implications of running without
> > > > a version script.  Isn't that what we use to make (eg, as an example
> > > > that we know has poor internal namespace control) libsmbclient safe, and
> > > > not expose all our internal guts, even on autoconf?
> > > > 
> > > > That is, can we do any shared libs, on any build system safely without
> > > > it?  
> > > 
> > > Symbol versioning is orthobonal to the export list
> > 
> > I could only find the build system code for the gnu ld linker script,
> > how is the export list specified otherwise?
> > 
> > I can't see any other mechanism that we use - libsmbclient doesn't use
> > _PUBLIC_ decorators either, so I'm genuinely curious how is this being
> > done!
> > 
> > Andrew Bartlett
> 
> The --version-script flag of the linker is used (check GNU ld docs for
> details) to define what symbols to make public, however you do not have
> to specify versions, the basics is to provide a list of 'global' symbols
> (to be exported) and define every other symbol as local (not exported).
> 
> In the autoconf build the export script is generated using the
> source3/script/mksyms.awk script I believe, and i derived from the
> library public header.
> 
> Search for SYMSEXT in Makefile.in to see what libs use it.
> 
> I think concealing symbols is available only when using gnu tools in the
> autoconf build.

What I'm getting at is this:  Is it safe to produce shared libraries
without gnu tools?

If it is not safe in general, is libwbclient simple enough to be an
exception?

The reason I'm asking is that with Samba 4.0 we are about to have an
explosion in the number of public shared libraries.  Following on from
the danger in exposing internal symbols, I'm thinking we should restrict
the production of public shared libs to systems with gnu ld.

Andrew Bartlett

-- 
Andrew Bartlett                                http://samba.org/~abartlet/
Authentication Developer, Samba Team           http://samba.org




More information about the samba-technical mailing list