From owner-freebsd-arch Wed Jan 24 7:49:33 2001 Delivered-To: freebsd-arch@freebsd.org Received: from gw.nectar.com (gw.nectar.com [208.42.49.153]) by hub.freebsd.org (Postfix) with ESMTP id 399EE37B400 for ; Wed, 24 Jan 2001 07:49:04 -0800 (PST) Received: from hamlet.nectar.com (hamlet.nectar.com [10.0.1.102]) by gw.nectar.com (Postfix) with ESMTP id 32E8B193E4; Wed, 24 Jan 2001 09:49:03 -0600 (CST) Received: (from nectar@localhost) by hamlet.nectar.com (8.11.1/8.9.3) id f0OFn3d50287; Wed, 24 Jan 2001 09:49:03 -0600 (CST) (envelope-from nectar@spawn.nectar.com) Date: Wed, 24 Jan 2001 09:49:02 -0600 From: "Jacques A. Vidrine" 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> References: <20010120153158.A88123@hamlet.nectar.com> <20010122120302.A93660@hamlet.nectar.com> <200101231956.f0NJuDW24253@vashon.polstra.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <200101231956.f0NJuDW24253@vashon.polstra.com>; from jdp@polstra.com on Tue, Jan 23, 2001 at 11:56:13AM -0800 X-Url: http://www.nectar.com/ Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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