This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] impliment branding for all FreeBSD platforms


2002-11-14  David O'Brien  <obrien@FreeBSD.org>
 
	* elf-fbsd.c: New file.
	* elf32-ppc.c: Add FreeBSD-specific EI_OSABI branding.
	* elf64-sparc.c: Likewise.
	* elf64-x86-64.c: Likewise.
	* elfxx-ia64.c: Likewise.
	* elf32-i386.c: Use elf-fbsd.c
	* elf64-alpha.c: Likewise.

 
Index: elf-fbsd.c
===================================================================
RCS file: elf-fbsd.c
diff -N elf-fbsd.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ elf-fbsd.c	14 Nov 2002 16:45:28 -0000
@@ -0,0 +1,42 @@
+/* Specific support for ELF on FreeBSD.
+   Copyright 2002 Free Software Foundation, Inc.
+
+This file is part of BFD, the Binary File Descriptor library.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+/* The kernel recognizes static executables as valid only if they carry a
+   "branding" in the ELF header.  So we brand all native binaries and
+   (for simplicity) also all other object files.  */
+
+static void elf_fbsd_post_process_headers
+  PARAMS ((bfd *, struct bfd_link_info *));
+
+static void
+elf_fbsd_post_process_headers (abfd, link_info)
+     bfd * abfd;
+     struct bfd_link_info * link_info ATTRIBUTE_UNUSED;
+{
+  Elf_Internal_Ehdr * i_ehdrp;	/* ELF file header, internal form.  */
+
+  i_ehdrp = elf_elfheader (abfd);
+
+  /* Put an ABI label supported by FreeBSD >= 4.1.  */
+  i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_FREEBSD;
+#ifdef OLD_FREEBSD_ABI_LABEL
+  /* The ABI label supported by FreeBSD <= 4.0 is quite nonstandard.  */
+  memcpy (&i_ehdrp->e_ident[EI_ABIVERSION], "FreeBSD", 8);
+#endif
+}
Index: elf32-i386.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-i386.c,v
retrieving revision 1.89
diff -u -r1.89 elf32-i386.c
--- elf32-i386.c	6 Nov 2002 11:38:35 -0000	1.89
+++ elf32-i386.c	14 Nov 2002 16:45:29 -0000
@@ -3396,32 +3396,10 @@
 #undef	TARGET_LITTLE_NAME
 #define	TARGET_LITTLE_NAME		"elf32-i386-freebsd"
 
-/* The kernel recognizes executables as valid only if they carry a
-   "FreeBSD" label in the ELF header.  So we put this label on all
-   executables and (for simplicity) also all other object files.  */
-
-static void elf_i386_post_process_headers
-  PARAMS ((bfd *, struct bfd_link_info *));
-
-static void
-elf_i386_post_process_headers (abfd, link_info)
-     bfd *abfd;
-     struct bfd_link_info *link_info ATTRIBUTE_UNUSED;
-{
-  Elf_Internal_Ehdr *i_ehdrp;
-
-  i_ehdrp = elf_elfheader (abfd);
-
-  /* Put an ABI label supported by FreeBSD >= 4.1.  */
-  i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_FREEBSD;
-#ifdef OLD_FREEBSD_ABI_LABEL
-  /* The ABI label supported by FreeBSD <= 4.0 is quite nonstandard.  */
-  memcpy (&i_ehdrp->e_ident[EI_ABIVERSION], "FreeBSD", 8);
-#endif
-}
+#include "elf-fbsd.c"
 
 #undef	elf_backend_post_process_headers
-#define	elf_backend_post_process_headers      elf_i386_post_process_headers
+#define	elf_backend_post_process_headers	elf_fbsd_post_process_headers
 
 #define	elf32_bed			elf32_i386_fbsd_bed
 
Index: elf32-ppc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-ppc.c,v
retrieving revision 1.54
diff -u -r1.54 elf32-ppc.c
--- elf32-ppc.c	6 Nov 2002 11:38:35 -0000	1.54
+++ elf32-ppc.c	14 Nov 2002 16:45:29 -0000
@@ -3850,3 +3850,26 @@
 #define elf_backend_reloc_type_class		ppc_elf_reloc_type_class
 
 #include "elf32-target.h"
+
+/* FreeBSD support.  */
+
+#undef	TARGET_LITTLE_SYM
+#define	TARGET_LITTL_SYM	bfd_elf32_powerpcle_freebsd_vec
+#undef	TARGET_LITTL_NAME
+#define	TARGET_LITTL_NAME	"elf32-powerpcle-freebsd"
+#undef	TARGET_BIG_SYM
+#define	TARGET_BIG_SYM		bfd_elf32_powerpc_freebsd_vec
+#undef	TARGET_BIG_NAME
+#define	TARGET_BIG_NAME		"elf32-powerpc-freebsd"
+
+#include "elf-fbsd.c"
+
+#undef	elf_backend_post_process_headers
+#define	elf_backend_post_process_headers	elf_fbsd_post_process_headers
+
+#define	elf32_bed		bfd_elf32_powerpc_freebsd_vec
+
+#include "elf32-target.h"
+
+#undef	elf_backend_post_process_headers
+#undef	elf32_bed
Index: elf64-alpha.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-alpha.c,v
retrieving revision 1.85
diff -u -r1.85 elf64-alpha.c
--- elf64-alpha.c	23 Oct 2002 20:21:21 -0000	1.85
+++ elf64-alpha.c	14 Nov 2002 16:45:30 -0000
@@ -5583,39 +5583,19 @@
 
 /* FreeBSD support.  */
 
-#undef TARGET_LITTLE_SYM
+#undef  TARGET_LITTLE_SYM
 #define TARGET_LITTLE_SYM	bfd_elf64_alpha_freebsd_vec
-#undef TARGET_LITTLE_NAME
+#undef  TARGET_LITTLE_NAME
 #define TARGET_LITTLE_NAME	"elf64-alpha-freebsd"
 
-/* The kernel recognizes executables as valid only if they carry a
-   "FreeBSD" label in the ELF header.  So we put this label on all
-   executables and (for simplicity) also all other object files.  */
+#include "elf-fbsd.c"
 
-static void elf64_alpha_fbsd_post_process_headers
-  PARAMS ((bfd *, struct bfd_link_info *));
+#undef  elf_backend_post_process_headers
+#define elf_backend_post_process_headers	elf_fbsd_post_process_headers
 
-static void
-elf64_alpha_fbsd_post_process_headers (abfd, link_info)
-     bfd * abfd;
-     struct bfd_link_info * link_info ATTRIBUTE_UNUSED;
-{
-  Elf_Internal_Ehdr * i_ehdrp;	/* ELF file header, internal form.  */
-
-  i_ehdrp = elf_elfheader (abfd);
-
-  /* Put an ABI label supported by FreeBSD >= 4.1.  */
-  i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_FREEBSD;
-#ifdef OLD_FREEBSD_ABI_LABEL
-  /* The ABI label supported by FreeBSD <= 4.0 is quite nonstandard.  */
-  memcpy (&i_ehdrp->e_ident[EI_ABIVERSION], "FreeBSD", 8);
-#endif
-}
-
-#undef elf_backend_post_process_headers
-#define elf_backend_post_process_headers \
-  elf64_alpha_fbsd_post_process_headers
-
-#define elf64_bed elf64_alpha_fbsd_bed
+#define elf64_bed		elf64_alpha_fbsd_bed
 
 #include "elf64-target.h"
+
+#undef  elf_backend_post_process_headers
+#undef  elf64_bed
Index: elf64-sparc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-sparc.c,v
retrieving revision 1.63
diff -u -r1.63 elf64-sparc.c
--- elf64-sparc.c	12 Nov 2002 06:21:05 -0000	1.63
+++ elf64-sparc.c	14 Nov 2002 16:45:31 -0000
@@ -3167,3 +3167,22 @@
 #define elf_backend_plt_header_size PLT_HEADER_SIZE
 
 #include "elf64-target.h"
+
+/* FreeBSD support.  */
+
+#undef  TARGET_BIG_SYM
+#define TARGET_BIG_SYM	bfd_elf64_sparc_freebsd_vec
+#undef  TARGET_BIG_NAME
+#define TARGET_BIG_NAME	"elf64-sparc-freebsd"
+
+#include "elf-fbsd.c"
+
+#undef  elf_backend_post_process_headers
+#define elf_backend_post_process_headers	elf_fbsd_post_process_headers
+
+#define elf64_bed		elf64_sparc_fbsd_bed
+
+#include "elf64-target.h"
+
+#undef  elf_backend_post_process_headers
+#undef  elf64_bed
Index: elf64-x86-64.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-x86-64.c,v
retrieving revision 1.52
diff -u -r1.52 elf64-x86-64.c
--- elf64-x86-64.c	1 Oct 2002 09:15:34 -0000	1.52
+++ elf64-x86-64.c	14 Nov 2002 16:45:32 -0000
@@ -2932,3 +2932,22 @@
 #define bfd_elf64_mkobject		    elf64_x86_64_mkobject
 
 #include "elf64-target.h"
+
+/* FreeBSD support.  */
+
+#undef  TARGET_LITTLE_SYM
+#define TARGET_LITTLE_SYM	bfd_elf64_x86_64_freebsd_vec
+#undef  TARGET_LITTLE_NAME
+#define TARGET_LITTLE_NAME	"elf64-x86-64-freebsd"
+
+#include "elf-fbsd.c"
+
+#undef  elf_backend_post_process_headers
+#define elf_backend_post_process_headers	elf_fbsd_post_process_headers
+
+#define elf64_bed		bfd_elf64_x86_64_freebsd_vec
+
+#include "elf64-target.h"
+
+#undef  elf_backend_post_process_headers
+#undef  elf64_bed
Index: elfxx-ia64.c
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-ia64.c,v
retrieving revision 1.60
diff -u -r1.60 elfxx-ia64.c
--- elfxx-ia64.c	12 Nov 2002 06:21:05 -0000	1.60
+++ elfxx-ia64.c	14 Nov 2002 16:45:33 -0000
@@ -4827,3 +4827,26 @@
 #include "elfNN-target.h"
 
 #undef  elf_backend_want_p_paddr_set_to_zero
+
+/* FreeBSD support.  */
+
+#undef  TARGET_LITTLE_SYM		
+#define TARGET_LITTLE_SYM		bfd_elfNN_ia64_little_freebsd_vec
+#undef  TARGET_LITTLE_NAME
+#define TARGET_LITTLE_NAME		"elfNN-ia64-little-freebsd"
+#undef  TARGET_BIG_SYM
+#define TARGET_BIG_SYM			bfd_elfNN_ia64_big_freebsd_vec
+#undef  TARGET_BIG_NAME
+#define TARGET_BIG_NAME			"elfNN-ia64-big-freebsd"
+
+#include "elf-fbsd.c"
+
+#undef  elf_backend_post_process_headers
+#define elf_backend_post_process_headers	elf_fbsd_post_process_headers
+
+#define elfNN_bed			bfd_elfNN_ia64_little_freebsd_vec
+
+#include "elfNN-target.h"
+
+#undef  elf_backend_post_process_headers
+#undef  elfNN_bed


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]