[patch] xserver:dri

Adam Jackson ajax at nwnk.net
Wed Feb 11 12:10:08 PST 2009


On Wed, 2009-02-11 at 10:10 -0800, Ian Romanick wrote:

> These are sensible changes, but I don't think it fixes the underlying
> problem.  The real problem, as you suggest, is that
> xf86LoaderCheckSymbol is a completely worthless interface.  What is
> really needed is one of the following:

Only useless for data symbols.

> - xf86LoaderGetSymbol that either returns a pointer to the symbol or NULL.

That's what LoaderSymbol does.  Admittedly it conflates "this symbol
really is located at address 0" with "this symbol does not exist", but
in practice this isn't a problem in X.

> - Support for weak symbols from the loader.  For example, if
> noPanoramiXExtension were weak, there wouldn't be an unresolved symbol
> error at dlopen.  The error would come if the loaded module tried to use
> the symbol.

That's not quite what weak symbols do.  Weak symbols have their value go
to zero (with no error) if a strong symbol of the same name is not
found.  So there wouldn't be an error if the module tried to use the
weak symbol's value.

You're welcome to _use_ weak symbols in Xorg.  We're an ELF shop, after
all.  But for the no*Extension variables, it will give you the wrong
boolean sense, so it's not a useful thing to do.

The problem here is that noPanoramiXExtension is a data symbol.
Function symbols can be resolved lazily by the runtime linker, because
there's only one way in the ABI to call a symbol, so you can find all
the call sites and patch them up to really call a resolver function.
Data symbols, on the other hand, could be accessed any way you like,
their addresses mangled by constant folding or any of the other
optimizations the compiler will do, so there's really no way to fix them
up after the fact.  So they have to resolve at dlopen time.

    Bool *npe = LoaderSymbol("noPanoramiXExtension");
    if (npe && !*npe)
        /* Xinerama is enabled, bail out */
    else
        /* either it's disabled or we built without it */

- ajax
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
Url : http://lists.x.org/archives/xorg-devel/attachments/20090211/436e15f6/attachment.pgp 


More information about the xorg-devel mailing list