Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 Oct 1996 20:13:36 -0700
From:      Jason Thorpe <thorpej@nas.nasa.gov>
To:        Michael Smith <msmith@atrad.adelaide.edu.au>
Cc:        sos@freebsd.org, jdp@polstra.com, hackers@freebsd.org
Subject:   Re: Linux compat issue(s) 
Message-ID:  <199610170313.UAA25575@lestat.nas.nasa.gov>

next in thread | raw e-mail | index | archive | help
On Thu, 17 Oct 1996 11:59:44 +0930 (CST) 
 Michael Smith <msmith@atrad.adelaide.edu.au> wrote:

 > Ok, "modulo the usual Linux crap".  Note that the path-detecting code
 > probably wants to understand /compat/netbsd, which hadn't occurred to me
 > before.

NetBSD does this ... /emul/freebsd :-)

 > NetBSD people lurking - is there a reliable way to discriminate a static 
 > NetBSD ELF i386 binary from any other static i386 ELF binary?

Not that I know of, no.  The last time I discussed this issue with
Linus (hmm, I think I saved the thread somewhere...), he seemed to
think that the best way to deal with that was to make the BSD ABIs
match Linux.  I.e. he didn't seem to care to much that it was a problem.
One of this suggestions was to watch for the first call to sbrk(2), since
"many" (his word) Linux crt0.o's do this before any other system calls.

"Matching ABIs" is a particular problem for NetBSD, of course, because
the system call switch, errno values, stat structures, etc. a different
for all of Linux's supported architectures.

"Whatever."

After a week-long e-mail exchange, nothing really useful came out of
it at all... Two ideas were discussed among the NetBSD developers:

	(1) Use some of the unused bytes at the end of e_ident[].
	    I.e. have something like:

		\177 E L F <class> <data> <version> N B S D
	    
	    If some OS chooses not to look at the entire e_ident[]
	    field, well, tough :-)

	(2) Use a special notes section.

I think we pretty much settled on (1), since it's possible to strip
out all of the section headers, and still have a runnable executable.
(I think; correct me if I'm wrong. :-)

(The thread was mostly about "So, now that NetBSD/alpha is switching
to ELF64, how can we find a sane way to differentiate between NetBSD/alpha
and Linux/alpha ELF64 executables...)

Jason R. Thorpe                                       thorpej@nas.nasa.gov
NASA Ames Research Center                               Home: 408.866.1912
NAS: M/S 258-6                                          Work: 415.604.0935
Moffett Field, CA 94035                                Pager: 415.428.6939



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