QEMU: About native libraries bridge

A mail on the QEMU development mailing-list reminded me of a proof-of-concept (PoC) I did 3 months ago. Native libraries support (henceforth nativelib) in QEMU user-space linux emulation code. The initial goal was to have pthreads emulation for a linux/i386 user-space. The longer-term goal is broader and is beyond the scope of QEMU and is actually what I was working on (very sparsely!) the past 4 years through various experiments in nearly-inexistent spare time.

So, what's the status on the QEMU project side? Well, here is a tarball and a patch provided as is for the QEMU PoC. It passes the QEMU testthread test and bridges enough of libpthread and librt for that purpose. That implementation is weak insofar as nativelib lookup is really sub-optimal. Other implementations are meant to run-time patch ld.so, this provides more flexibily and permits to selectively nativelib a few functions (e.g. memcpy et al.), not the whole library.

How to build?

Please bear in mind this is just a PoC and is very incomplete in function coverage. If you still want to have a look, grab qemu 0.9.0 sources, preferably a 2007/02/14 snapshot, and apply both tarball and patch. Configure for a i386-linux-user target and make it. Then, in the i386-linux-user directory, delete the nativelib-*.so files and re-make them with CC=“gcc -m32”. This assumes your host was x86_64. Otherwise, simply go to an i386 system and manually build the nativelibs.

How does it work?