mock issues on ia64 with LoadLibrary("libc.so.6")

Roland McGrath roland at redhat.com
Thu Dec 20 09:19:13 UTC 2007


What mock is doing there is a little freaky.  Since the functions you want
are in libc and you know it's always going to be there, you don't really
need to ask for the right libc object by name.  
You can use dlsym (RTLD_DEFAULT, "function") to look up the functions in
the global scope that the python executable uses, which gets to libc.

The python code doesn't seem to have a way to use RTLD_DEFAULT.
But, when you do:

	_libc = ctypes.cdll.LoadLibrary(None)

That translates to dlopen (NULL, ...), which in fact works the same as
dlopen ("", ...), i.e. opens the executable itself (python).  Since libc is
a dependency of the executable, its symbols are found by dlsym on the
handle from dlopen (NULL, ...).

In short, to the extent this whole kludge of the python code knowing the
ABI details of some libc symbols is sane at all, it's probably fine enough
to use "_libc = ctypes.cdll.LoadLibrary(None)" and be "portable".


Thanks,
Roland




More information about the Fedora-buildsys-list mailing list