PERFORCE change 31944 for review
Peter Wemm
peter at FreeBSD.org
Tue May 27 14:43:51 PDT 2003
http://perforce.freebsd.org/chv.cgi?CH=31944
Change 31944 by peter at 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;
More information about the p4-projects
mailing list