From owner-p4-projects@FreeBSD.ORG Tue May 27 14:43:50 2003 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id C911337B404; Tue, 27 May 2003 14:43:49 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8119237B401 for ; Tue, 27 May 2003 14:43:49 -0700 (PDT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1A59043F93 for ; Tue, 27 May 2003 14:43:49 -0700 (PDT) (envelope-from peter@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.6/8.12.6) with ESMTP id h4RLhm0U051916 for ; Tue, 27 May 2003 14:43:48 -0700 (PDT) (envelope-from peter@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.6/8.12.6/Submit) id h4RLhmFR051910 for perforce@freebsd.org; Tue, 27 May 2003 14:43:48 -0700 (PDT) Date: Tue, 27 May 2003 14:43:48 -0700 (PDT) Message-Id: <200305272143.h4RLhmFR051910@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to peter@freebsd.org using -f From: Peter Wemm To: Perforce Change Reviews Subject: PERFORCE change 31944 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 May 2003 21:43:51 -0000 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;