Date: Tue, 26 Jan 1999 22:16:20 +0000 (GMT) From: Terry Lambert <tlambert@primenet.com> To: Nate@primenet.com, Williams@primenet.com, <nate@mt.sri.com> Cc: Mats@primenet.com, Lofkvist@primenet.com, <mal@algonet.se>, java@FreeBSD.ORG Subject: Re: TowerJ for FreeBSD Message-ID: <199901262216.PAA01731@usr07.primenet.com>
next in thread | raw e-mail | index | archive | help
> > [snip] > > The Solaris JIT sources are not released. :( > > > > How far is FreeBSD from being able to run Solaris binaries? > > I din't know. It runs them now, and has for about two months. Mark Newton <newton@atdot.dotat.org> was recently given commit priviledges to be able to check his patches in, which loads an execution class for Solaris binaries as a KLD. If he hasn't checked them in yet, then you might want to either contact him directly, or check the list archives for the pointer to his patches (he posted it about a month ago). > > And how hard is it to add a feature allowing a FreeBSD binary (java) > > load and run a Solaris shared library (the Solaris JIT) with/without > > Solaris binary compatibility to begin with? > > Really hard. Hard enough that it will probably never be done. See > postings on hackers on this where Terry Lambert bogusly declared it was > trivial without understanding the details. The library is ELF, and is unrelocated, so it isn't Solaris specific excepet for partially preresolved jump table vector names. In general, the dependency is that most of these libraries are linked against the Solais libc, and bring in symbols from there. ELF provides for explicit specification of library dependencies for other libraries, and John Birrell wrote a tool a while back to allow editing of section contents (like the dependent library path). For example, a number of people have been using the Solaris CDE ELF library to get an ELF Motif 2.0 implementation that they can link against, since Sun used to offer the thing for download from their WWW site, and you can get it on the Solaris "free" ($15) CDROM. The biggest incompatability is that FreeBSD, instead of keeping the system call interface intact and adding 64 bit equivalents for things like lseek off_t's, which is what Solaris did, revamped the system call interface, breaking ABI compatability. To get around this, you have to first link a set of stubs with weak symbol wrappers for the affected functions to do the 32->64 wrapping, and some real symbols for things like lseek64. To make this actually work, these things have to make the system calls themselves, instead of relying on the default libc. Then you link like: /compat/solaris/usr/lib/libXm.a -lsol -lXt -lXext -lX11 -lc To use the Solaris libXm (Motif 2.0) library statically. It's pretty trivial (contrary to Nate's claims) to find the list of interfaces affected by just truing to link the Motif library directly. You'll get a list of unresolved externals. If the JAVA libraries do anything complicated, then you'll need to wrap some calls to convert manifest constants, e.g. FreeBSD has some ioctl() argument differences from the EABI (ELF) specifications that it has so far failed to correct, etc.. This is pretty darn easy to see by looking at the Solaris execution class KLD, which does most of these conversions. You can echo the conversions in a FreeBSD native stub library, as necessary, or, better still, fix FreeBSD to conform to the EABI. Actually, most undefined externals are not used by the Motif library; FreeBSD complains about them being unresolved because FreeBSD's linker has a bug. With a.out, it didn't force the equivalenet of LD_PRELOAD for externally referenced symbols for second order library dependencies. For ELF, they've screwed it up the other direction, and it enforces LD_PRELOAD style behaviour, even if the symbols are in dead code. You could actually stub the unused ones out, if you bothered to identify them, and ignore the wrapping altogether. Hopefully this provides you with enough information so that you can actually scale the task; IMO, it's quite approachable, even if you're not a kernel hacker type (since all you have to do with kernel code is read and understand the Solaris ABI KLD sources). Regards, Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-java" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199901262216.PAA01731>