From owner-freebsd-hackers@FreeBSD.ORG Wed Aug 10 05:54:25 2005 Return-Path: X-Original-To: hackers@freebsd.org Delivered-To: freebsd-hackers@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2AB2F16A6D3 for ; Wed, 10 Aug 2005 05:53:59 +0000 (GMT) (envelope-from ume@mahoroba.org) Received: from ameno.mahoroba.org (gw4.mahoroba.org [218.45.22.175]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5FEE943F38 for ; Wed, 10 Aug 2005 05:04:37 +0000 (GMT) (envelope-from ume@mahoroba.org) Received: from localhost (IDENT:woE1jpVpl4o0OGR83T7v8XqFLTUfbCh7xsCXrLBv0f6emm7k3U4eyI18pkr5OXFi@localhost [IPv6:::1]) (user=ume mech=CRAM-MD5 bits=0) by ameno.mahoroba.org (8.13.3/8.13.3) with ESMTP/inet6 id j7A53fKL078096 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 10 Aug 2005 14:03:45 +0900 (JST) (envelope-from ume@mahoroba.org) Date: Wed, 10 Aug 2005 14:03:41 +0900 Message-ID: From: Hajimu UMEMOTO To: Dan Nelson In-Reply-To: <20050809213130.GB71687@dan.emsphone.com> References: <20050809.133734.08360256.imp@bsdimp.com> <20050809213130.GB71687@dan.emsphone.com> User-Agent: xcite1.38> Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.7 (=?ISO-8859-4?Q?Sanj=F2?=) APEL/10.6 Emacs/21.3 (i386--freebsd) MULE/5.0 (SAKAKI) X-Operating-System: FreeBSD 5.4-STABLE X-PGP-Key: http://www.imasy.or.jp/~ume/publickey.asc X-PGP-Fingerprint: 1F00 0B9E 2164 70FC 6DC5 BF5F 04E9 F086 BF90 71FE Organization: Internet Mutual Aid Society, YOKOHAMA MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0 (ameno.mahoroba.org [IPv6:::1]); Wed, 10 Aug 2005 14:03:46 +0900 (JST) X-Virus-Scanned: by amavisd-new X-Virus-Status: Clean X-Spam-Status: No, score=-5.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.0.4 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on ameno.mahoroba.org Cc: hackers@freebsd.org Subject: Re: Converting libfoo.so for linux to freebsd X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Aug 2005 05:54:25 -0000 Hi, >>>>> On Tue, 9 Aug 2005 16:31:30 -0500 >>>>> Dan Nelson 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@mahoroba.org ume@{,jp.}FreeBSD.org http://www.imasy.org/~ume/