Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 17 Oct 1996 10:50:07 -0700
From:      John Polstra <jdp@polstra.com>
To:        sos@FreeBSD.org
Cc:        msmith@atrad.adelaide.edu.au, hackers@FreeBSD.org
Subject:   Re: Linux compat issue(s) 
Message-ID:  <199610171750.KAA03129@austin.polstra.com>
In-Reply-To: Your message of "Wed, 16 Oct 1996 20:14:56 %2B0200." <199610161814.UAA00583@SandBox.CyberCity.dk> 

next in thread | previous in thread | raw e-mail | index | archive | help
Somebody wrote:

> > > > I presume this uses a method that JDP can integrate with the linker, so that
> > > > it's not necessary to 'brand' ELF executables after you've made them?

I am attaching a patch for the elfkit-1.2.1 version of binutils, to make
it automatically brand all ELF files with "FreeBSD".  This patch is very
quick and very dirty.  If you're expecting a fine piece of software
engineering, look elsewhere.

I will try to come up with a better version that doesn't put
FreeBSD-specific code into a supposedly target independent source
file.  I looked at it for quite a while yesterday, and ran into the
usual problem:

    1. You want to merge your changes into binutils in a target
       independent way, so that GNU will accept them into the next
       release.

    2. The required hooks for doing it in a target independent way do
       not currently exist.

    3. Adding the necessary hooks would most likely require making
       changes to the target specific code for every ELF target.

    4. The resulting set of diffs would be so large that GNU probably
       wouldn't accept them.

    5. Go to step 1, and oh, by the way, have a nice day! :-)

John
--
   John Polstra                                       jdp@polstra.com
   John D. Polstra & Co., Inc.                Seattle, Washington USA
   "Self-knowledge is always bad news."                 -- John Barth

This is a patch to make the elfkit-1.2.1 tools "brand" all ELF files
with the "FreeBSD" tag, to indicate to the OS which API they expect to
use.  This patch should be applied after the elfkit-1.2.1 patches in
"patches/binutils-2.6.0.12.patch" have been applied.  To apply these
patches, chdir into the "binutils-2.6.0.12" directory, and do this:

    patch < this_file  # Where "this_file" is the name of this file, duh

Then build and install binutils-2.6.0.12 in the usual way.

Index: bfd/elf.c
===================================================================
RCS file: /home/jdp/elf/cvs/elf/binutils/bfd/elf.c,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 elf.c
--- elf.c	1996/03/30 01:32:11	1.1.1.2
+++ elf.c	1996/10/17 17:07:47
@@ -2384,6 +2384,8 @@
       break;
     case bfd_arch_i386:
       i_ehdrp->e_machine = EM_386;
+      /* Quick and dirty patch to "brand" the file as a FreeBSD ELF file. */
+      strncpy((char *) &i_ehdrp->e_ident[8], "FreeBSD", EI_NIDENT-8);
       break;
     case bfd_arch_m68k:
       i_ehdrp->e_machine = EM_68K;



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