From owner-freebsd-arch@FreeBSD.ORG Wed May 7 02:13:26 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 4202D37B401 for ; Wed, 7 May 2003 02:13:26 -0700 (PDT) Received: from mailhub.fokus.fraunhofer.de (mailhub.fokus.fraunhofer.de [193.174.154.14]) by mx1.FreeBSD.org (Postfix) with ESMTP id 07DD843F85 for ; Wed, 7 May 2003 02:13:25 -0700 (PDT) (envelope-from brandt@fokus.fraunhofer.de) Received: from beagle (beagle [193.175.132.100])h479DKE21219; Wed, 7 May 2003 11:13:20 +0200 (MEST) Date: Wed, 7 May 2003 11:13:20 +0200 (CEST) From: Harti Brandt To: "Andrey A. Chernov" In-Reply-To: <20030506190747.GA59160@nagual.pp.ru> Message-ID: <20030507111208.D3008@beagle.fokus.fraunhofer.de> References: <20030505175426.GA19352@madman.celabo.org> <20030505231135.GA21953@madman.celabo.org> <20030506190747.GA59160@nagual.pp.ru> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: freebsd-arch@freebsd.org cc: Dag-Erling Smorgrav Subject: 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: Wed, 07 May 2003 09:13:26 -0000 On Tue, 6 May 2003, Andrey A. Chernov wrote: AAC>On Tue, May 06, 2003 at 20:40:35 +0200, Dag-Erling Smorgrav wrote: AAC>> "Andrey A. Chernov" writes: AAC>> > On Tue, May 06, 2003 at 19:56:27 +0200, Dag-Erling Smorgrav wrote: AAC>> >> - If you stayed awake through the previous paragraph you should by AAC>> >> now have concluded that it simply is not possible for the linker to AAC>> >> enforce namespaces like Andrey wants it to, because a) the linker AAC>> >> can't know what headers were included; b) the exact set of reserved AAC>> >> names can vary from compilation unit to compilation unit within the AAC>> >> same application and c) namespace issues affect portions of the AAC>> >> code which are outside the linker's purview (such as the names of AAC>> >> function arguments and static or automatic variables). Namespaces AAC>> >> are a source code issue and cannot be handled anywhere but at the AAC>> >> source code level. AAC>> > There is no problem. Each *.h function prototype can be accompanied with AAC>> > some assembler instruction making it strong reference. The same thing can AAC>> > be conditionalized at the header level using _POSIX_SOURCE or other AAC>> > defines. So, linker will know, what headers are included. AAC>> AAC>> I would like to draw your attention to points b) and c) above and ask AAC>> how you plan to address them. AAC> AAC>About b), I don't quite understand, what you mean. If inside the same AAC>application some file includes, say, math.h and use sin() and another file AAC>not includes math.h and defines its own sin() it is error. It is not an error if the second sin() is static. Most symbols from headers are only reserved in external scope and when the corresponding header is included. harti -- harti brandt, http://www.fokus.fraunhofer.de/research/cc/cats/employees/hartmut.brandt/private brandt@fokus.fraunhofer.de, harti@freebsd.org