Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 27 May 2003 14:43:48 -0700 (PDT)
From:      Peter Wemm <peter@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 31944 for review
Message-ID:  <200305272143.h4RLhmFR051910@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=31944

Change 31944 by peter@peter_hammer on 2003/05/27 14:43:29

	Evil hack so that binutils can tell the difference between .o files
	of the format elf32-i386-freebsd and elf32-i386.  Without this,
	nm calls it 'ambiguous format' and cant do anything.  ar and ranlib
	etc wont build a libxxx.a __.SYMDEF etc (so ld says 'run ranlib') etc.
	Alpha also has the same issue, but amd64 is the only one that it hurts.

Affected files ...

.. //depot/projects/hammer/contrib/binutils/bfd/elf32-i386-fbsd.c#2 edit
.. //depot/projects/hammer/contrib/binutils/bfd/elf32-i386.c#4 edit

Differences ...

==== //depot/projects/hammer/contrib/binutils/bfd/elf32-i386-fbsd.c#2 (text+ko) ====

@@ -22,6 +22,9 @@
 #define ELF_ARCH		bfd_arch_i386
 #define ELF_MACHINE_CODE	EM_386
 #define ELF_MAXPAGESIZE		0x1000
+#ifdef __amd64__
+#define ELF_OSABI		ELFOSABI_FREEBSD
+#endif
 
 #include "bfd.h"
 #include "sysdep.h"

==== //depot/projects/hammer/contrib/binutils/bfd/elf32-i386.c#4 (text+ko) ====

@@ -629,6 +629,20 @@
   /* Allocate our special target data.  */
   struct elf_i386_obj_tdata *new_tdata;
   bfd_size_type amt = sizeof (struct elf_i386_obj_tdata);
+  Elf_Internal_Ehdr * i_ehdrp;  /* ELF file header, internal form.  */
+
+  i_ehdrp = elf_elfheader (abfd);
+
+#ifdef __amd64__
+#ifdef ELF_OSABI
+  if (i_ehdrp->e_ident[EI_OSABI] != ELF_OSABI)
+    return false;
+#endif
+#if defined(__FreeBSD__) && !defined(ELF_OSABI)
+  if (i_ehdrp->e_ident[EI_OSABI] == ELFOSABI_FREEBSD)
+    return false;
+#endif
+#endif
   new_tdata = bfd_zalloc (abfd, amt);
   if (new_tdata == NULL)
     return false;



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