Converting libfoo.so for linux to freebsd

Hajimu UMEMOTO ume at freebsd.org
Wed Aug 10 05:54:25 GMT 2005


Hi,

>>>>> On Tue, 9 Aug 2005 16:31:30 -0500
>>>>> Dan Nelson <dnelson at allantgroup.com> said:

dnelson> In the last episode (Aug 09), M. Warner Losh said:
> I have recently purcahsed a device that comes with a .so for linux,
> but no sources.  Is there any way one can take an arbitrary linux .so
> which appears to have no dependencies to a FreeBSD .so?  The binary
> code is about 20k or so.

dnelson> As long as any structs that are passed back and forth have the same
dnelson> members and alignment, it should work.  This includes struct FILE,
dnelson> which means if the app tries to use stdio it'll likely crash.

dnelson> I just compiled a little "hello world" object file on SUSE and linked
dnelson> it on FreeBSD and it ran (it just calls printf, which is safe since it
dnelson> doesn't pass a FILE *).

As far as the Linux shlib uses the functions which ABI are compatible
with FreeBSD's one, it should work.  However, if there are some ABI
incompatibility, you may want to consider the approach of
linuxpluginwrapper.
The PIPS ports (print/pips*) link Linux shlib to FreeBSD binary.  To
do this, the PIPS ports use www/linuxpluginwrapper to fixup some ABI
incompatibility.

Sincerely,

--
Hajimu UMEMOTO @ Internet Mutual Aid Society Yokohama, Japan
ume at mahoroba.org  ume@{,jp.}FreeBSD.org
http://www.imasy.org/~ume/


More information about the freebsd-hackers mailing list