Question about importing symbols

Adam Jackson ajax at nwnk.net
Mon Nov 30 11:50:59 PST 2009


We resolved this on IRC, but just for posterity:

On Mon, 2009-11-30 at 13:55 -0500, Timothy Normand Miller wrote:

> Here's something interesting we just figured out.  If we do something
> like this, we get the unresolved symbol error:
> 
> pScreen->CreateWindow = fbCreateWindow;
> 
> However, if we CALL the function, we don't get the error.

This is a data reference, which ELF requires be resolvable on module
load.  Which won't ever happen, because your driver hasn't called
LoadSubModule() when it's dlopen()'d.

> > The "required" list is the list of symbols to error fatally on.  The
> > "referenced" list is the list to _not_ error fatally on, presumably
> > because you know when you're being careful with them.
> 
> Is that the second pointer argument to xf86LoaderReqSymLists ?

No, xf86LoaderReqSymLists() is varargs.  The "referenced" list is set up
with xf86LoaderRefSymLists().  All of one character different, how nice.

> > The lookup cost is not much worse than that of dlsym().  The runtime
> > performance ends up being slightly better than direct symbol calls
> > because you're not banging through the PLT every time.
> 
> What's the name of the function to call to look up a symbol by name?

void *LoaderSymbol(const char *sym);

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


More information about the xorg-devel mailing list