From owner-freebsd-hackers Tue Oct 15 09:43:46 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id JAA18451 for hackers-outgoing; Tue, 15 Oct 1996 09:43:46 -0700 (PDT) Received: from austin.polstra.com (austin.polstra.com [206.213.73.10]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id JAA18446; Tue, 15 Oct 1996 09:43:42 -0700 (PDT) Received: from austin.polstra.com (jdp@localhost) by austin.polstra.com (8.7.6/8.7.3) with ESMTP id JAA03974; Tue, 15 Oct 1996 09:43:34 -0700 (PDT) Message-Id: <199610151643.JAA03974@austin.polstra.com> To: msmith@atrad.adelaide.edu.au Cc: hackers@freebsd.org, sos@freebsd.org Subject: Re: Linux compat issue(s) In-reply-to: <199610150917.SAA21553@genesis.atrad.adelaide.edu.au> Date: Tue, 15 Oct 1996 09:43:33 -0700 From: John Polstra Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk > Should I assume that this is the "what static ELF binary is this" > problem? > > Is anyone working on this, or should I try for a fix? Any further > suggestions beyond those raised in the discussions a while back? > JDP? Yeah, I said I was going to do something about this, and then I dropped the ball. Sorry. GNU binutils is so damned frustrating to work with, I just had to get away from it for a while. I still don't agree with Soren: > ... ELF is > only supposed to handle ONE os type per platform, what we are doing > is blasfemy (ie not running SVR4). > > There has been some talk between the various free groups, but there > has been no consensus yet, and I dont see the ELF std being rewritten > just because we say its faulty. So ELF is like the plaque, there > is no current cure :) ELF _does_ have a mechanism for doing what we want. Quoting from the "Program Header" section of the spec: Note Section Sometimes a vendor or system builder needs to mark an object file with special information that other programs will check for conformance, compatibility, etc. Sections of type SHT_NOTE and program header elements of type PT_NOTE can be used for this purpose. I still think this is the way to go. I played around with it a little bit, and got it sort of limping along. The ELF linker in binutils allows you to add a Note section to the program header without modifying any code in the linker, by using a custom linker script. But that feature is buggy as hell, and its only diagnostic seems to be "core dumped". I did finally get it to put the Note section in properly. But I concluded that the linker script mechanism wasn't flexible enough for our purposes. The linker itself would have to be modified somewhat. I think that was around the time I contracted a severe case of GNU spaghetti indigestion, which left me unable to even glance at the binutils code without breaking out into a cold sweat. (The symptoms linger to this day.) [He pops another Valium ... :-] The Note section idea also doesn't solve the entire problem. We could mark our own FreeBSD ELF files with Note sections, so we could recognize them. But unless we could persuade the Linux people to do likewise, we'd still be unable to distinguish between Linux ELF files and SVR4 ELF files. This is going to be a problem no matter what we do, though. John -- John Polstra jdp@polstra.com John D. Polstra & Co., Inc. Seattle, Washington USA "Self-knowledge is always bad news." -- John Barth