Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 7 May 2003 11:13:20 +0200 (CEST)
From:      Harti Brandt <brandt@fokus.fraunhofer.de>
To:        "Andrey A. Chernov" <ache@nagual.pp.ru>
Cc:        Dag-Erling Smorgrav <des@ofug.org>
Subject:   Re: `Hiding' libc symbols
Message-ID:  <20030507111208.D3008@beagle.fokus.fraunhofer.de>
In-Reply-To: <20030506190747.GA59160@nagual.pp.ru>
References:  <20030505175426.GA19352@madman.celabo.org> <xzpk7d53zu5.fsf@flood.ping.uio.no> <20030505231135.GA21953@madman.celabo.org> <xzpy91k3j9n.fsf@flood.ping.uio.no> <xzpllxkez78.fsf@flood.ping.uio.no> <xzp8ytjgbq4.fsf@flood.ping.uio.no> <20030506190747.GA59160@nagual.pp.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
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" <ache@nagual.pp.ru> 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



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