From owner-freebsd-arch@FreeBSD.ORG Tue May 6 08:59:24 2003 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0C2BC37B401; Tue, 6 May 2003 08:59:24 -0700 (PDT) Received: from mailhub.fokus.fraunhofer.de (mailhub.fokus.fraunhofer.de [193.174.154.14]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9FAF743F93; Tue, 6 May 2003 08:59:22 -0700 (PDT) (envelope-from brandt@fokus.fraunhofer.de) Received: from beagle (beagle [193.175.132.100])h46FxLE27334; Tue, 6 May 2003 17:59:21 +0200 (MEST) Date: Tue, 6 May 2003 17:59:21 +0200 (CEST) From: Harti Brandt To: "Jacques A. Vidrine" In-Reply-To: <20030506153641.GI77708@madman.celabo.org> Message-ID: <20030506175400.F631@beagle.fokus.fraunhofer.de> References: <20030501182820.GA53641@madman.celabo.org> <20030505175426.GA19352@madman.celabo.org> <20030506092519.GA3158@cirb503493.alcatel.com.au> <20030506153641.GI77708@madman.celabo.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: freebsd-arch@FreeBSD.org Subject: Re: Re: `Hiding' libc symbols X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 May 2003 15:59:24 -0000 On Tue, 6 May 2003, Jacques A. Vidrine wrote: JAV>On Tue, May 06, 2003 at 11:43:13AM +0200, Harti Brandt wrote: JAV>> To say it otherwise: I think hiding names that are not in Posix/Ansi is a JAV>> good thing, because we must assume, that applications have functions with JAV>> the same names doing entirely different things. Hiding names that are not JAV>> standardized functions, but are in the standard or implementation JAV>> namespace is probably a good thing to do too. Hiding functions that are in JAV>> the standards is a bad thing. If applications use these names, we should JAV>> assume that the function does at least what the standard requires. If not JAV>> the application is broken and must be fixed. Otherwise we will break an JAV>> unknown number of applications. JAV> JAV>We _already_ hide many POSIX/ANSI names, without any ill effects or JAV>portability consequences. Please understand the issues before posting. JAV> JAV>Since I set $SUBJECT, I will re-state what I meant by `hiding' libc JAV>symbols. I was specifically referring to the namespace.h/weak symbol JAV>method which we have been using for over 100 functions in libc for JAV>years. Please! I know what I'm talking about. I have been hit by the broken shared library design in BSD/OS and I have been hit by all those non-standard functions with names that each application writer loves to use in our libc (err for example), but I have also on occasions replace exit with abort to find a very obscure bug, I sometimes use a debugging libmalloc, I know libraries that replace str* functions to find bound errors. I'm just telling that simply hiding all symbols without caring of what that may cause is certainly wrong. And stating that this will automagically make buggy ports un-buggier is also wrong. JAV>That is: JAV> JAV>Renaming the internal implementation of `foo' to `_foo', and creating JAV>a weak symbol alias with the original name (`foo'). Within libc, JAV>use the `_foo' name when the semantics must be known (e.g. when the JAV>behavior must not be overridden by an application accidently, i.e. JAV>almost always). Macros in `namespace.h' help the compiler with JAV>prototypes etc. Go ahead with non-standard functions, but make sure that you don't break ports when doing this with standard functions. harti -- harti brandt, http://www.fokus.fraunhofer.de/research/cc/cats/employees/hartmut.brandt/private brandt@fokus.fraunhofer.de, harti@freebsd.org