Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 24 Jan 2001 09:49:02 -0600
From:      "Jacques A. Vidrine" <n@nectar.com>
To:        arch@freebsd.org
Subject:   Re: other approach for hiding names (was Re: Request For Review: libc/libc_r changes to allow -lc_r)
Message-ID:  <20010124094902.A42047@hamlet.nectar.com>
In-Reply-To: <200101231956.f0NJuDW24253@vashon.polstra.com>; from jdp@polstra.com on Tue, Jan 23, 2001 at 11:56:13AM -0800
References:  <20010120153158.A88123@hamlet.nectar.com> <Pine.SUN.3.91.1010120171614.8403A-100000@pcnet1.pcnet.com> <20010122120302.A93660@hamlet.nectar.com> <200101231956.f0NJuDW24253@vashon.polstra.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Jan 23, 2001 at 11:56:13AM -0800, John Polstra wrote:
> > I'm beginning to think that the pre-processor is the wrong tool for
> > the job.  It can't tell a function or object declaration from other
> > tokens.
> > 
> > Is there somewhere in the build process that we could insert a tool
> > that does something like the following?
> > 
> >   for each externally visible symbol:
> >     skip symbol if it is reserved (e.g. '_[A-Z_]')
> >     skip symbol if it is not on the ISO C name list [1]
> >     if the symbol is defined in this module:
> >       rename 'symbol' to '__symbol'
> >       add weak reference for 'symbol' -> '__symbol'
> >     else (the symbol is an undefined reference):
> >       rename 'symbol' to '__symbol'
> 
> I'm really leery of introducing a special tool for this.  I think it
> could cause problems with upgrading from older versions, and would
> make us needlessly and confusingly different from the other BSDs.

But, if we take the route which Daniel used [1], simply to hide
symbols, then soon we will be `needlessly and confusingly' different
from the other BSDs.  Do we really want every other [2] function call
in libc to be prepended with an underscore?

> Also I think it's a lot clearer to be able to see what is going on
> by looking at the source files, without having to remember the magic
> going on behind the scenes.

I have to disagree.  The magic is instead now in header files, and it
is fragile and fraught with exceptions.


On the other hand, if we don't have a goal of a pristine namespace,
then the number of symbols we have to deal with is probably manageable
with the pre-processor approach, if not aesthetically pleasing.
-- 
Jacques Vidrine / n@nectar.com / jvidrine@verio.net / nectar@FreeBSD.org

[1] I don't have a problem with what Daniel committed.  The functions 
    handled in his commit have special requirements for threads, and 
    are relatively few in number.

[2] A rough count shows 4.2-STABLE libc with about 1025 symbols in the
    application namespace.  Of these, about 853 need to be hidden.
    Many are probably leaf functions, or at least do not call any other 
    functions that need to be hidden.
 
  
  


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010124094902.A42047>