Enforcing server and API in a dlloader world
Adam Jackson
ajax at nwnk.net
Mon May 23 10:51:57 PDT 2005
On Monday 23 May 2005 06:43, Daniel Stone wrote:
> On Mon, May 23, 2005 at 12:27:41PM +0200, Egbert Eich wrote:
> > It would be nice if we could preserve the former behavior so that we
> > would be able to keep the symbols to export from the core in a single
> > place while we come up with a more restrictive behavior than the
> > latter one.
> >
> > If we could turn the list of symbols into a map file while we use the
> > apporach of specifying the symbols to export inside the code itself
> > for the modules we have a solution which would preserve as much as
> > possible of the resent behavior.
>
> The only real way to achieve this would be to generate a custom linker
> script from xf86sym.c, which is pretty nasty. I also don't know how
> portable linker scripts are.
Most platforms have them, in some form or other. I don't know how portable
their syntax is, I've not really played with them much.
> Surely the best thing to do would just be to have someone sit down and
> manually mark all the symbols in xf86sym.c, dixsym.c, fontsym.c and
> friends X_VISIBLE (or whatever it is), and then we could build with
> -fvisibility=hidden? This takes us back to the old elfloader
> behaviour, where people were required to manually export symbols. It
> also prevents any 'accidental' exposing of symbols: only the ones
> people want to be visible will be visible.
_X_EXPORT is what the patch in #3360 does, and I'm about halfway though doing
the markup for the symbols listed in *sym.c (just have xf86sym.c to go I
think).
I don't know how useful it is to have the symbol export list in one place. If
you really want to know the list of exported symbols from the server, under
dlloader:
$ nm -D Xorg | grep -v ' U '
Whereas with _X_EXPORT tagging, if you want to know if the symbol is exported,
you look at its definition. It's a style choice I suppose.
I can certainly do linker maps as well though, if people think that's a good
idea. It'd help enforce the API on systems with deficient compilers, which
is still a fair number (-fvisibility wasn't formally introduced until gcc
4.0, for example).
Oh, and, style hint: Please don't export variables directly.
- ajax
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg/attachments/20050523/3dea30fe/attachment.pgp>
More information about the xorg
mailing list