Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Sep 1996 07:50:08 +0200 (MET DST)
From:      Juergen Lock <nox@jelal.hb.north.de>
To:        jehamby@lightside.com
Cc:        jdrobina@infinet.com, freebsd-emulation@freebsd.org
Subject:   Re: Linker from Slackware always produces staticly linked programs
Message-ID:  <199609230550.HAA00627@saturn.hb.north.de>
In-Reply-To: <Pine.AUX.3.94.960919140302.29880A-100000@covina.lightside.com> from Jake Hamby at "Sep 22, 96 12:51:44 pm"

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199609230550.HAA00627>