From owner-freebsd-emulation Sun Sep 22 22:55:11 1996 Return-Path: owner-emulation Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id WAA22633 for emulation-outgoing; Sun, 22 Sep 1996 22:55:11 -0700 (PDT) Received: from deceased.hb.north.de (deceased.hb.north.de [194.94.232.249]) by freefall.freebsd.org (8.7.5/8.7.3) with SMTP id WAA22602 for ; Sun, 22 Sep 1996 22:55:07 -0700 (PDT) Received: from jelal.hb.north.de by deceased.hb.north.de with uucp (Smail3.2) id m0v53tD-0016EYC; Mon, 23 Sep 1996 07:49:07 +0200 (MET DST) Received: by jelal.hb.north.de (SMail-ST 0.95gcc/2.5+) id AA00281; Mon, 23 Sep 1996 07:51:22 +0100 (CET) Received: (from nox@localhost) by saturn.hb.north.de (8.7.5/8.7.3) id HAA00627; Mon, 23 Sep 1996 07:50:09 +0200 (MET DST) From: Juergen Lock Message-Id: <199609230550.HAA00627@saturn.hb.north.de> Subject: Re: Linker from Slackware always produces staticly linked programs To: jehamby@lightside.com Date: Mon, 23 Sep 1996 07:50:08 +0200 (MET DST) Cc: jdrobina@infinet.com, freebsd-emulation@freebsd.org In-Reply-To: from Jake Hamby at "Sep 22, 96 12:51:44 pm" X-Mailer: ELM [version 2.4ME+ PL19 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-emulation@freebsd.org X-Loop: FreeBSD.org Precedence: bulk Jake Hamby writes: > On Thu, 19 Sep 1996, James Drobina wrote: >... > > The linker distribued with SLackware 96 is > > $ ld -v > > ld version cygnus-2.6 (with BFD 2.6.0.14) > > > > If I replace the Slackare 96 linker with an older version. I can link > > dynamic programs and hello world works. I backed the linker out and > > replaced it with > > > > $ ./ld -v > > ld version cygnus/linux-2.5.2l.17 (with BFD cygnus/linux-2.5.2l.11) > > > > Has anyone seen this problem? Is it a slackware problem or an emulation > > problem? > > It's an ELF problem. Last time I looked at the code, the ELF loader > figured out whether it was loading a FreeBSD, Linux, or SVR4 ELF binary by > the name of the dynamic loader (ld.so), which is in a different directory > on each of the three. For statically linked programs, there is physically > no way to tell the difference between ELF programs for each OS (!) so it > assumes a native FreeBSD ELF program (yes there is such a beast, there is > an elfkit available for download, I believe on freefall.freebsd.org). > > We're caught between a rock and a hard place here, because on the one > hand, any statically linked ELF binary is most likely to be Linux, simply > because nobody's using FreeBSD ELF yet (because, unlike Linux, our a.out > format doesn't suck :-), but on the other hand, if/when we do decide to > move to ELF, there _will_ be a lot of statically linked _FreeBSD_ ELF > binaries. Is there no way at least these _FreeBSD_ ELF binaries can be marked somehow (if all else fails a few `magic' bytes, whatever)? > > I guess the solution is to find or make an a.out (or dynamically linked > ELF) version of the programs in question. Or if your desperate and you know all your ELF binaries are linux try this, Index: kern/imgact_elf.c =================================================================== RCS file: /home/cvs/cvs/src/sys/kern/imgact_elf.c,v retrieving revision 1.8 diff -u -r1.8 imgact_elf.c --- imgact_elf.c 1996/08/31 16:52:23 1.8 +++ imgact_elf.c 1996/09/07 19:40:35 @@ -644,8 +644,12 @@ goto fail; } } - else + else { imgp->entry_addr = entry; +#if defined(STATIC_ELF_LINUX) + imgp->proc->p_sysent = &elf_linux_sysvec; +#endif + } /* * Construct auxargs table (used by the fixup routine) and set options "STATIC_ELF_LINUX" in the config file... > > -- Jake cheers, Juergen