From owner-freebsd-hackers@FreeBSD.ORG Mon Aug 15 05:45:00 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 1EF0716A41F for ; Mon, 15 Aug 2005 05:45:00 +0000 (GMT) (envelope-from root@Neo-Vortex.net) Received: from Neo-Vortex.net (203-217-81-6.dyn.iinet.net.au [203.217.81.6]) by mx1.FreeBSD.org (Postfix) with ESMTP id B9A4A43D53 for ; Mon, 15 Aug 2005 05:44:58 +0000 (GMT) (envelope-from root@Neo-Vortex.net) Received: from localhost.Neo-Vortex.net (Neo-Vortex@localhost.Neo-Vortex.net [127.0.0.1]) by Neo-Vortex.net (8.13.3/8.13.3) with ESMTP id j7F5iIkv024143; Mon, 15 Aug 2005 15:44:20 +1000 (EST) (envelope-from root@Neo-Vortex.net) Date: Mon, 15 Aug 2005 15:44:18 +1000 (EST) From: Neo-Vortex To: "M. Warner Losh" In-Reply-To: <20050809.164636.112623550.imp@bsdimp.com> Message-ID: <20050815154220.C23503@Neo-Vortex.net> References: <20050809.133734.08360256.imp@bsdimp.com> <20050809212708.GS94041@cicely12.cicely.de> <20050809.164636.112623550.imp@bsdimp.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: hackers@freebsd.org, ticso@cicely.de 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: Mon, 15 Aug 2005 05:45:00 -0000 On Tue, 9 Aug 2005, M. Warner Losh wrote: > In message: <20050809212708.GS94041@cicely12.cicely.de> > Bernd Walter writes: > : On Tue, Aug 09, 2005 at 01:37:34PM -0600, M. Warner Losh wrote: > : > 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. > : > : Isn't this just brandelf'ing to FreeBSD-i386? > : Asuming that the lib really has no dependencies to linux specific > : device/kernel features or linux specific libs. > > I tried brandelfing, but that didn't work. There's some weird symbols > in there: > > 00000000 DF *UND* 00000023 GLIBC_2.0 fprintf > 00000000 DF *UND* 000000f8 GLIBC_2.0 fflush > 00000000 DF *UND* 000001b4 GLIBC_2.0 malloc > 00000000 DF *UND* 00000058 GLIBC_2.0 memmove > 00000000 DO *UND* 00000004 GLIBC_2.0 stderr > 00000000 DF *UND* 0000020d GLIBC_2.0 abort > 00000000 DF *UND* 00000027 GLIBC_2.0 memcpy > 00000000 w DF *UND* 000000ac GLIBC_2.1.3 __cxa_finalize > 00000000 DF *UND* 00000043 GLIBC_2.0 memset > > So it looks like I'm close... objcopy -R kept the GLIBC_* references > in place, alas, so that didn't work, as suggested elsewhere in this > thread. > > The above list is small, but has hree bad entries: fprintf, fflush and > stderr. So that may present a problem for me if these functions are > ever called. > > Warner Well, those functions do exist... except for stderr, although that is a varible (libc) The problem is that when you brandelf a .so file, it dosen't do anything, whatever uses it must be brandelf'd and compiled for linux... (well, in my experience with it it does nothing that i have noticed) If you can compile whatever needs to use it as linux then brandelf it, it should work ~Neo-Vortex