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]

Re: BFD msbin patch


G'day,

Ok here's the BFD Microsoft .BIN format patch, against CVS and
without any generated files.

> Nick Clifton wrote:
> >
> > Another issue is copyright.  Before we could accept such a patch we
> > would need a completed copyright assignment from you.  (Form attached
> > below).

I take it the FSF has to send me some paperwork; this hasn't
happened yet so the patch is only presented for comments.


diff -ruN --exclude-from=bfd.excludes binutils-cvs-20020214.orig/bfd/ChangeLog binutils-cvs-20020214.work/bfd/ChangeLog
--- binutils-cvs-20020214.orig/bfd/ChangeLog	Thu Feb 14 14:44:07 2002
+++ binutils-cvs-20020214.work/bfd/ChangeLog	Thu Feb 14 14:40:17 2002
@@ -1,3 +1,10 @@
+2002-02-14  Greg Banks  <gnb@alphalink.com.au>
+
+	* Makefile.am, bfd-in2.h, msbin.c, targets.c, configure.in:  Add
+	support for Microsoft BIN format.
+	* doc/targets.texi, doc/bfdint.texi: Update to mention MSBIN.
+	* configure, Makefile.in: Regenerate.
+
 2002-02-14  Alan Modra  <amodra@bigpond.net.au>
 
 	* elf.c (elf_fake_sections): Use SHT_NOBITS when SEC_NEVER_LOAD.
diff -ruN --exclude-from=bfd.excludes binutils-cvs-20020214.orig/bfd/Makefile.am binutils-cvs-20020214.work/bfd/Makefile.am
--- binutils-cvs-20020214.orig/bfd/Makefile.am	Mon Feb 11 16:01:55 2002
+++ binutils-cvs-20020214.work/bfd/Makefile.am	Thu Feb 14 11:53:01 2002
@@ -25,11 +25,13 @@
 # for the debugger, so if you are downloading things as S-records you
 # need two copies of the executable, one to download and one for the
 # debugger).
+# Greg Banks: ditto MS-BIN format, which similar to S-records in concept
+# but uses binary extents rather than ASCII lines.
 BFD32_LIBS = \
 	archive.lo archures.lo bfd.lo cache.lo coffgen.lo corefile.lo \
 	format.lo init.lo libbfd.lo opncls.lo reloc.lo \
 	section.lo syms.lo targets.lo hash.lo linker.lo \
-	srec.lo binary.lo tekhex.lo ihex.lo stabs.lo stab-syms.lo \
+	srec.lo msbin.lo binary.lo tekhex.lo ihex.lo stabs.lo stab-syms.lo \
 	merge.lo dwarf2.lo
 
 BFD64_LIBS = archive64.lo
@@ -38,7 +40,7 @@
 	archive.c archures.c bfd.c cache.c coffgen.c corefile.c \
 	format.c init.c libbfd.c opncls.c reloc.c \
 	section.c syms.c targets.c hash.c linker.c \
-	srec.c binary.c tekhex.c ihex.c stabs.c stab-syms.c \
+	srec.c msbin.c binary.c tekhex.c ihex.c stabs.c stab-syms.c \
 	merge.c dwarf2.c
 
 BFD64_LIBS_CFILES = archive64.c
@@ -818,6 +820,8 @@
 linker.lo: linker.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
   genlink.h
 srec.lo: srec.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
+  $(INCDIR)/safe-ctype.h
+msbin.lo: msbin.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
   $(INCDIR)/safe-ctype.h
 binary.lo: binary.c $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h
 tekhex.lo: tekhex.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h
diff -ruN --exclude-from=bfd.excludes binutils-cvs-20020214.orig/bfd/configure.in binutils-cvs-20020214.work/bfd/configure.in
--- binutils-cvs-20020214.orig/bfd/configure.in	Fri Feb  8 16:33:23 2002
+++ binutils-cvs-20020214.work/bfd/configure.in	Thu Feb 14 11:55:48 2002
@@ -676,6 +676,7 @@
     mcore_pei_little_vec)	tb="$tb pei-mcore.lo peigen.lo cofflink.lo" ;;
     mipslpe_vec)		tb="$tb pe-mips.lo peigen.lo cofflink.lo" ;;
     mipslpei_vec)		tb="$tb pei-mips.lo peigen.lo cofflink.lo" ;;
+    msbin_vec)	    	    	tb="$tb msbin.lo" ;;
     newsos3_vec)		tb="$tb newsos3.lo aout32.lo" ;;
     nlm32_alpha_vec)		tb="$tb nlm32-alpha.lo nlm32.lo nlm.lo"; target_size=64 ;;
     nlm32_i386_vec)		tb="$tb nlm32-i386.lo nlm32.lo nlm.lo" ;;
diff -ruN --exclude-from=bfd.excludes binutils-cvs-20020214.orig/bfd/doc/bfdint.texi
binutils-cvs-20020214.work/bfd/doc/bfdint.texi
--- binutils-cvs-20020214.orig/bfd/doc/bfdint.texi	Wed Oct 31 02:20:03 2001
+++ binutils-cvs-20020214.work/bfd/doc/bfdint.texi	Thu Feb 14 11:56:18 2002
@@ -337,6 +337,8 @@
 openVMS.
 @item bfd_target_mmo_flavour
 Donald Knuth's MMIXware object format.
+@item bfd_target_msbin_flavour
+Microsoft BIN format.
 @end table
 
 @item byteorder
diff -ruN --exclude-from=bfd.excludes binutils-cvs-20020214.orig/bfd/msbin.c binutils-cvs-20020214.work/bfd/msbin.c
--- binutils-cvs-20020214.orig/bfd/msbin.c	Thu Jan  1 10:00:00 1970
+++ binutils-cvs-20020214.work/bfd/msbin.c	Thu Feb 14 14:32:18 2002
@@ -0,0 +1,570 @@
+/* BFD back-end for Microsoft BIN objects.
+   Copyright 2002
+   Free Software Foundation, Inc.
+   Written by Greg Banks <gnb@alphalink.com.au>.
+
+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.  */
+
+
+/*
+MSBIN format is a simple binary format for downloading programs to
+embedded systems, created by Microsoft because they like creating
+new file formats.
+
+A .msbin file comprises a fixed size file header followed by a
+sequence of sections.  The file header is the following structure,
+(where LONG is a little-endian unsigned 32 bit integer):
+
+FILE_HEADER
+{
+    char magic[7] = "B000FF\n"
+    LONG bound_start
+    LONG bound_end
+};
+
+Each section comprises a fixed size header and a variable sized body.
+The section header is the following structure.
+
+SECTION_HEADER
+{
+   LONG address
+   LONG length
+   LONG checksum
+};
+
+The `checksum' field is a simple unsigned sum of all the bytes in
+the section data.
+
+The end of the file is marked by a section in which the `address'
+field is 0, the `length' field contains the program launch address,
+and the body is empty.
+*/
+ 
+#include "bfd.h"
+#include "sysdep.h"
+#include "libbfd.h"
+#include "libiberty.h"
+
+#ifndef MSBIN_DEBUG
+#define MSBIN_DEBUG 0
+#endif
+
+
+/* describes one (or more, merged) sections */
+typedef struct
+{
+  int nsections;
+  bfd_vma lma;
+  bfd_vma size;
+  unsigned long checksum; /* over all sections */
+} msbin_sec_data;
+
+#define	msbin_close_and_cleanup _bfd_generic_close_and_cleanup
+#define msbin_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
+#define msbin_new_section_hook _bfd_generic_new_section_hook
+#define msbin_get_section_contents \
+  _bfd_generic_get_section_contents
+#define msbin_get_section_contents_in_window \
+  _bfd_generic_get_section_contents_in_window
+  
+#define msbin_get_symtab_upper_bound bfd_0l
+#define msbin_get_symtab \
+      (long (*) PARAMS ((bfd *, struct symbol_cache_entry **))) bfd_0l
+#define msbin_print_symbol _bfd_nosymbols_print_symbol
+#define msbin_get_symbol_info _bfd_nosymbols_get_symbol_info
+#define msbin_bfd_is_local_label_name _bfd_nosymbols_bfd_is_local_label_name
+#define msbin_get_lineno _bfd_nosymbols_get_lineno
+#define msbin_find_nearest_line _bfd_nosymbols_find_nearest_line
+#define msbin_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
+#define msbin_read_minisymbols _bfd_nosymbols_read_minisymbols
+#define msbin_minisymbol_to_symbol _bfd_nosymbols_minisymbol_to_symbol
+
+#define msbin_get_reloc_upper_bound \
+      (long (*) PARAMS ((bfd *, sec_ptr))) bfd_0l
+#define msbin_canonicalize_reloc \
+      (long (*) PARAMS ((bfd *, sec_ptr, arelent **, struct symbol_cache_entry **))) bfd_0l
+#define msbin_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup
+
+
+static boolean msbin_scan PARAMS ((bfd *));
+static const bfd_target *msbin_object_check_format PARAMS ((bfd *));
+static boolean msbin_is_loadable_section PARAMS ((sec_ptr));
+static boolean msbin_write_header PARAMS ((bfd *));
+static void msbin_update_checksum
+    PARAMS ((struct sec *, unsigned char *p, bfd_size_type));
+static boolean msbin_write_section_header 
+    PARAMS ((bfd *, bfd_vma, bfd_vma, bfd_vma));
+static boolean msbin_write_section PARAMS ((bfd *, struct sec *));
+static boolean msbin_write_terminator PARAMS ((bfd *));
+static boolean msbin_object_write_contents PARAMS ((bfd *));
+static asymbol *msbin_make_empty_symbol PARAMS ((bfd *));
+static boolean msbin_set_arch_mach
+    PARAMS ((bfd *, enum bfd_architecture, unsigned long));
+static void msbin_locate_sections PARAMS ((bfd *));
+static boolean msbin_set_section_contents
+    PARAMS ((bfd *, sec_ptr, PTR, file_ptr, bfd_size_type));
+
+
+#define MSBIN_MAGIC   	      	"B000FF\n"
+#define MSBIN_MAGIC_LEN       	7
+#define MSBIN_FILE_HEADER_LEN 	15
+#define MSBIN_SEC_HEADER_LEN 	12
+
+/* Scan the msbin file for sections and make bfd sections
+ * from them.  Assumes the file descriptor is positioned
+ * at the end of the file header.
+ */
+static boolean
+msbin_scan (abfd)
+    bfd *abfd;
+{
+  bfd_vma address;
+  bfd_vma length;
+  bfd_vma checksum;
+  bfd_vma filepos;
+  struct sec *section;
+  char secbuf[32];
+  char *secname;
+  char hdr[MSBIN_SEC_HEADER_LEN];
+
+  filepos = MSBIN_FILE_HEADER_LEN;
+  
+  for (;;)
+    {
+      if (bfd_bread (hdr, MSBIN_SEC_HEADER_LEN, abfd) != MSBIN_SEC_HEADER_LEN)
+      	{
+	  bfd_set_error (bfd_error_wrong_format);
+	  return false;
+	}
+      filepos += MSBIN_SEC_HEADER_LEN;
+	
+      address = bfd_getl32 (&hdr[0]);
+      length = bfd_getl32 (&hdr[4]);
+      checksum = bfd_getl32 (&hdr[8]);
+
+      if (address == 0UL)
+	{
+	  /* terminating record */
+	  abfd->start_address = length;
+	  return true;
+	}
+	
+      /* create the bfd section */
+      sprintf (secbuf, ".sec%d", bfd_count_sections (abfd) + 1);
+      secname = (char *) bfd_alloc (abfd, strlen (secbuf) + 1);
+      strcpy (secname, secbuf);
+      section = bfd_make_section (abfd, secname);
+      if (section == (struct sec *) NULL)
+      	return false;
+	
+      section->flags = SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC;
+      section->vma = address;
+      section->lma = address;
+      section->_raw_size = length;
+      section->filepos = filepos;
+      
+      /* TODO: check the checksum? */
+      
+      /* seek to the next section */
+      filepos += length;
+      if (bfd_seek (abfd, (file_ptr) filepos, SEEK_SET) != 0)
+      	{
+	  bfd_set_error (bfd_error_wrong_format);
+	  return false;
+	}
+    }
+    
+  return true;
+}
+
+/* Check whether an existing file is MS-BIN format.  */
+static const bfd_target *
+msbin_object_check_format (abfd)
+     bfd *abfd;
+{
+  char hdr[MSBIN_FILE_HEADER_LEN];
+
+#if MSBIN_DEBUG
+  fprintf(stderr, "msbin_object_check_format()\n");
+#endif
+
+  if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0
+      || bfd_bread (hdr, MSBIN_FILE_HEADER_LEN, abfd) != MSBIN_FILE_HEADER_LEN)
+    return NULL;
+
+  if (memcmp (hdr, MSBIN_MAGIC, MSBIN_MAGIC_LEN))
+    {
+      bfd_set_error (bfd_error_wrong_format);
+      return NULL;
+    }
+    
+  if (! msbin_scan (abfd))
+    return NULL;
+
+  return abfd->xvec;
+}
+
+/* Predicate returning whether a section is loadable, i.e.
+ * we don't just totally ignore it 
+ */
+static boolean
+msbin_is_loadable_section (section)
+    sec_ptr section;
+{
+  return (section->flags & SEC_ALLOC
+      	  && section->flags & SEC_LOAD
+	  && section->_cooked_size > 0);
+}
+
+static boolean
+msbin_write_header (abfd)
+     bfd *abfd;
+{
+  struct sec *section;
+  bfd_vma bound_start = 0xffffffffUL;
+  bfd_vma bound_end = 0UL;
+  bfd_vma start;
+  bfd_vma end;
+  char hdr[MSBIN_FILE_HEADER_LEN];
+  
+  
+  /* scan sections to calculate address bound */
+  for ( section = abfd->sections ; section != (struct sec *)NULL ; section = section->next )
+    {
+      if (msbin_is_loadable_section (section))
+	{
+      	  start = section->lma;
+	  end = start + section->_cooked_size;
+
+	  if (start < bound_start)
+	    bound_start = start;
+	  if (end > bound_end)
+	    bound_end = end;
+	}
+    }
+    
+  if (bound_end == 0UL)
+    return false;
+  
+  memcpy(hdr, MSBIN_MAGIC, MSBIN_MAGIC_LEN);
+  bfd_putl32 (bound_start, &hdr[7]);
+  bfd_putl32 (bound_end-bound_start, &hdr[11]);
+  if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) == -1)
+    return false;
+  if (bfd_bwrite ((PTR) hdr, sizeof(hdr), abfd) != sizeof(hdr))
+    return false;
+  return true;
+}
+
+static void
+msbin_update_checksum (section, p, n)
+     struct sec *section;
+     unsigned char *p;
+     bfd_size_type n;
+{
+  msbin_sec_data *sdata = (msbin_sec_data *) section->used_by_bfd;
+  unsigned long sum = sdata->checksum;
+  bfd_size_type i;
+  
+  for ( i = 0 ; i < n ; i++ )
+      sum += *p++;
+  
+  sdata->checksum = sum;
+}
+
+static boolean
+msbin_write_section_header (abfd, address, length, checksum)
+    bfd *abfd;
+    bfd_vma address;
+    bfd_vma length;
+    bfd_vma checksum;
+{
+  char hdr[MSBIN_SEC_HEADER_LEN];
+  
+  bfd_putl32 (address, &hdr[0]);
+  bfd_putl32 (length, &hdr[4]);
+  bfd_putl32 (checksum, &hdr[8]);
+  if (bfd_bwrite ((PTR) hdr, sizeof(hdr), abfd) != sizeof(hdr))
+    return false;
+  return true;
+}
+
+static boolean
+msbin_write_section (abfd, section)
+     bfd *abfd;
+     struct sec *section;
+{
+  msbin_sec_data *sdata = (msbin_sec_data *) section->used_by_bfd;
+  
+#if MSBIN_DEBUG
+  fprintf(stderr, "msbin_write_section: 0x%08lx, 0x%08lx\n",
+      sdata->lma, sdata->size);
+#endif
+      
+  /* write section header */
+  if (bfd_seek (abfd, (file_ptr) (section->filepos - MSBIN_SEC_HEADER_LEN),
+      	      	SEEK_SET) == -1)
+    return false;
+  if (!msbin_write_section_header (abfd, sdata->lma, sdata->size,
+      	      	      	      	   sdata->checksum))
+    return false;
+    
+  return true;
+}
+
+static boolean
+msbin_write_terminator (abfd)
+     bfd *abfd;
+{
+  struct sec *section;
+  bfd_vma end;
+  bfd_vma last;
+
+#if MSBIN_DEBUG
+  fprintf(stderr, "msbin_write_terminator()\n");
+#endif
+
+  /* Find the last section written out.  Yes, it's a kludge */
+  
+  last = 0UL;
+  for ( section = abfd->sections ; section != (struct sec *)NULL ; section = section->next )
+    {
+      if (msbin_is_loadable_section (section))
+      	{
+#if MSBIN_DEBUG
+	  fprintf(stderr, "msbin_write_terminator: %s 0x%08lx -> {%d, 0x%08lx, 0x%08lx}\n",
+	      	  section->name,
+	      	  section->filepos,
+		  ((msbin_sec_data *)section->used_by_bfd)->nsections,
+		  ((msbin_sec_data *)section->used_by_bfd)->lma,
+		  ((msbin_sec_data *)section->used_by_bfd)->size);
+#endif
+	  
+	  end = section->filepos + section->_cooked_size;
+	  if (end > last)
+	    last = end;
+	}
+    }
+  if (last == 0UL)
+    return false;
+
+  if (bfd_seek (abfd, (file_ptr) last, SEEK_SET) == -1)
+    return false;
+  if (!msbin_write_section_header (abfd, 0UL, abfd->start_address, 0UL))
+    return false;
+    
+  return true;
+}
+
+static boolean
+msbin_object_write_contents (abfd)
+     bfd *abfd;
+{
+  struct sec *section;
+  msbin_sec_data *sdata;
+  msbin_sec_data *prev_sdata = (msbin_sec_data *) NULL;
+  
+#if MSBIN_DEBUG
+  fprintf(stderr, "msbin_object_write_contents()\n");
+#endif
+
+  if (! msbin_write_header (abfd))
+    return false;
+
+  for ( section = abfd->sections ; section != (struct sec *)NULL ; section = section->next )
+    {
+      if (!msbin_is_loadable_section (section))
+	continue;
+	
+      sdata = (msbin_sec_data *) section->used_by_bfd;
+      if (sdata != prev_sdata)
+      	{
+	  /* start new section */
+	  if (! msbin_write_section (abfd, section))
+	    return false;
+	}
+      
+      prev_sdata = sdata;
+    }
+
+  return msbin_write_terminator (abfd);
+}
+
+
+/* The only reason this function exists is to allow the
+ * silly implementation of bfd_make_section_anyway() to
+ * actually ever create any sections at all.
+ */
+static asymbol *
+msbin_make_empty_symbol (abfd)
+     bfd *abfd;
+{
+  asymbol *new = (asymbol *) bfd_zalloc (abfd, sizeof (asymbol));
+  if (new)
+    new->the_bfd = abfd;
+  return new;
+}
+
+
+/* Set the architecture.  We accept an unknown architecture here.  */
+
+static boolean
+msbin_set_arch_mach (abfd, arch, mach)
+     bfd *abfd;
+     enum bfd_architecture arch;
+     unsigned long mach;
+{
+  if (arch == bfd_arch_unknown)
+    {
+      abfd->arch_info = &bfd_default_arch_struct;
+      return true;
+    }
+  return bfd_default_set_arch_mach (abfd, arch, mach);
+}
+
+/* Calculate the section->filepos member for each
+ * allocated & loaded section, so that the generic
+ * set_contents routine does the right thing.  Also
+ * handles merging contiguous sections and allocates
+ * the msbin_sec_data structures.
+ */
+ 
+/* TODO: pad sections to (default 16 bytes) and merge nearly-contiguous ones */
+
+static void
+msbin_locate_sections (abfd)
+     bfd *abfd;
+{
+  struct sec *section;
+  bfd_vma filepos;
+  msbin_sec_data *sdata = (msbin_sec_data *) NULL;
+  
+#if MSBIN_DEBUG
+  fprintf(stderr, "msbin_locate_sections()\n");
+#endif
+
+  filepos = MSBIN_FILE_HEADER_LEN;
+  for ( section = abfd->sections ; section != (struct sec *)NULL ; section = section->next )
+    {
+      if (!msbin_is_loadable_section (section))
+      	continue;
+	
+      if (sdata != (msbin_sec_data *) NULL
+          && (sdata->lma + sdata->size) == section->lma)
+	{
+	  /* ok, can merge with previous section */
+	  /* TODO: this assumes sections are sorted on lma -- check */
+	  sdata->nsections++;
+	  sdata->size += section->_cooked_size;
+	}
+      else
+      	{
+	  /* have to start a new msbin_sec_data */
+	  sdata = (msbin_sec_data *) bfd_alloc (abfd, sizeof(msbin_sec_data));
+	  sdata->nsections = 1;
+	  sdata->lma = section->lma;
+	  sdata->size = section->_cooked_size;
+	  sdata->checksum = 0UL;
+	  filepos += MSBIN_SEC_HEADER_LEN;
+	}
+      section->used_by_bfd = (PTR) sdata;
+      section->filepos = filepos;
+      filepos += section->_cooked_size;
+    }
+}
+
+static boolean
+msbin_set_section_contents (abfd, section, location, offset, bytes_to_do)
+     bfd *abfd;
+     sec_ptr section;
+     PTR location;
+     file_ptr offset;
+     bfd_size_type bytes_to_do;
+{
+  if (!abfd->output_has_begun)
+      msbin_locate_sections (abfd);
+    
+  if (msbin_is_loadable_section (section))
+  {
+#if MSBIN_DEBUG
+    fprintf(stderr, "Setting contents for section \"%s\"[%d]\n",
+	section->name, section->index);
+#endif
+
+    msbin_update_checksum (section, (unsigned char *) location, bytes_to_do);
+    return _bfd_generic_set_section_contents(abfd, section, location, offset, bytes_to_do);
+  }
+    
+  return true;
+}
+
+/* TODO: data in headers is little-endian (being Microsoft of course),
+ *       should we report that in header_byteorder ?
+ */
+const bfd_target msbin_vec =
+{
+  "msbin",			/* name */
+  bfd_target_msbin_flavour,
+  BFD_ENDIAN_UNKNOWN,		/* target byte order */
+  BFD_ENDIAN_UNKNOWN,		/* target headers byte order */
+  ( EXEC_P | WP_TEXT ),       	/* object flags */
+  ( SEC_CODE | SEC_DATA	      	/* section flags */
+   | SEC_ROM | SEC_HAS_CONTENTS
+   | SEC_ALLOC | SEC_LOAD ),
+  0,				/* leading underscore */
+  ' ',				/* ar_pad_char */
+  16,				/* ar_max_namelen */
+  bfd_getb64, bfd_getb_signed_64, bfd_putb64,
+  bfd_getb32, bfd_getb_signed_32, bfd_putb32,
+  bfd_getb16, bfd_getb_signed_16, bfd_putb16,	/* data */
+  bfd_getb64, bfd_getb_signed_64, bfd_putb64,
+  bfd_getb32, bfd_getb_signed_32, bfd_putb32,
+  bfd_getb16, bfd_getb_signed_16, bfd_putb16,	/* hdrs */
+
+  {
+    _bfd_dummy_target,
+    msbin_object_check_format,	/* bfd_check_format */
+    _bfd_dummy_target,
+    _bfd_dummy_target,
+  },
+  {
+    bfd_false,
+    bfd_true,
+    bfd_false,
+    bfd_false,
+  },
+  {				/* bfd_write_contents */
+    bfd_false,
+    msbin_object_write_contents,
+    bfd_false,
+    bfd_false,
+  },
+
+  BFD_JUMP_TABLE_GENERIC (msbin),
+  BFD_JUMP_TABLE_COPY (_bfd_generic),
+  BFD_JUMP_TABLE_CORE (_bfd_nocore),
+  BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive),
+  BFD_JUMP_TABLE_SYMBOLS (msbin),
+  BFD_JUMP_TABLE_RELOCS (msbin),
+  BFD_JUMP_TABLE_WRITE (msbin),
+  BFD_JUMP_TABLE_LINK (_bfd_nolink),
+  BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
+
+  NULL,
+
+  (PTR) 0
+};
diff -ruN --exclude-from=bfd.excludes binutils-cvs-20020214.orig/bfd/targets.c binutils-cvs-20020214.work/bfd/targets.c
--- binutils-cvs-20020214.orig/bfd/targets.c	Fri Feb  8 16:33:23 2002
+++ binutils-cvs-20020214.work/bfd/targets.c	Thu Feb 14 12:01:33 2002
@@ -155,7 +155,8 @@
 .  bfd_target_msdos_flavour,
 .  bfd_target_ovax_flavour,
 .  bfd_target_evax_flavour,
-.  bfd_target_mmo_flavour
+.  bfd_target_mmo_flavour,
+.  bfd_target_msbin_flavour
 .};
 .
 .enum bfd_endian { BFD_ENDIAN_BIG, BFD_ENDIAN_LITTLE, BFD_ENDIAN_UNKNOWN };
@@ -668,6 +669,7 @@
 extern const bfd_target tekhex_vec;
 extern const bfd_target binary_vec;
 extern const bfd_target ihex_vec;
+extern const bfd_target msbin_vec;
 
 /* All of the xvecs for core files.  */
 extern const bfd_target aix386_core_vec;
@@ -974,6 +976,8 @@
 	&binary_vec,
 /* Likewise for ihex.  */
 	&ihex_vec,
+/* and msbin too.  */
+	&msbin_vec,
 
 /* Add any required traditional-core-file-handler.  */
 



Greg.
-- 
the price of civilisation today is a courageous willingness to prevail,
with force, if necessary, against whatever vicious and uncomprehending
enemies try to strike it down.	   - Roger Sandall, The Age, 28Sep2001.


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