Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 06 May 2003 22:50:04 -0700
From:      Terry Lambert <tlambert2@mindspring.com>
To:        Dag-Erling Smorgrav <des@ofug.org>
Cc:        freebsd-arch@freebsd.org
Subject:   Re: `Hiding' libc symbols
Message-ID:  <3EB89E8C.FD00B065@mindspring.com>
References:  <20030501182820.GA53641@madman.celabo.org> <XFMail.20030501144502.jhb@FreeBSD.org> <20030501191027.GA53801@madman.celabo.org> <20030505110601.H53365@beagle.fokus.fraunhofer.de> <20030505175426.GA19352@madman.celabo.org> <xzpk7d53zu5.fsf@flood.ping.uio.no> <20030505205051.GA40572@nagual.pp.ru> <20030505231135.GA21953@madman.celabo.org> <20030505231837.GA44533@nagual.pp.ru> <20030506170823.GI83663@lucky.net> <xzpllxkez78.fsf@flood.ping.uio.no>

next in thread | previous in thread | raw e-mail | index | archive | help
Dag-Erling Smorgrav wrote:
>  - If you stayed awake through the previous paragraph you should by
>    now have concluded that it simply is not possible for the linker to
>    enforce namespaces like Andrey wants it to, because a) the linker
>    can't know what headers were included; b) the exact set of reserved
>    names can vary from compilation unit to compilation unit within the
>    same application and c) namespace issues affect portions of the
>    code which are outside the linker's purview (such as the names of
>    function arguments and static or automatic variables).  Namespaces
>    are a source code issue and cannot be handled anywhere but at the
>    source code level.

Technically, this is not true.  However, tiered dependencies
will still enable this to break (A(standard 1) depends on lib
containing B(standard 1+) depends on libc(standard 1++)).

Other than that, you could, using an ELF section, attribute
the object files by the standards which were in effect when
they were compiled, and do one heck of a lot of work in the
linker and with symbol decoration to deal with this.

This can be made to work with #pragma, if you are using a
compiler with an external preprocessor.

In effect, this is what Linux does, when it versions it's
ABI in the current glibc ABI, and in its kernel modules
symbol stuff.  Its why I object so strongly to changing
FreeBSD to do the same thing, even though there are clever
tricks you can do if you have it.

Doing this would be almost incredibly painful, since it would
involve namespace attributed symbols, and import and export
lists.

But it's *possible*.

-- Terry



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