daily update
[deliverable/binutils-gdb.git] / bfd / srec.c
index f792d971d9f69a0731e433c1d957b8bf7b625a11..e184a20eaa3b3e01e44ededcf6b08080c9685c33 100644 (file)
@@ -1,6 +1,6 @@
 /* BFD back-end for s-record objects.
    Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-   2000, 2001, 2002
+   2000, 2001, 2002, 2003, 2004
    Free Software Foundation, Inc.
    Written by Steve Chamberlain of Cygnus Support <sac@cygnus.com>.
 
@@ -132,13 +132,13 @@ static bfd_boolean srec_get_section_contents
 static bfd_boolean srec_set_arch_mach
   PARAMS ((bfd *, enum bfd_architecture, unsigned long));
 static bfd_boolean srec_set_section_contents
-  PARAMS ((bfd *, sec_ptr, PTR, file_ptr, bfd_size_type));
+  PARAMS ((bfd *, sec_ptr, const PTR, file_ptr, bfd_size_type));
 static bfd_boolean internal_srec_write_object_contents PARAMS ((bfd *, int));
 static bfd_boolean srec_write_object_contents PARAMS ((bfd *));
 static bfd_boolean symbolsrec_write_object_contents PARAMS ((bfd *));
 static int srec_sizeof_headers PARAMS ((bfd *, bfd_boolean));
 static long srec_get_symtab_upper_bound PARAMS ((bfd *));
-static long srec_get_symtab PARAMS ((bfd *, asymbol **));
+static long srec_canonicalize_symtab PARAMS ((bfd *, asymbol **));
 
 /* Macros for converting between hex and binary.  */
 
@@ -299,8 +299,8 @@ srec_bad_byte (abfd, lineno, c, error)
          buf[1] = '\0';
        }
       (*_bfd_error_handler)
-       (_("%s:%d: Unexpected character `%s' in S-record file\n"),
-        bfd_archive_filename (abfd), lineno, buf);
+       (_("%B:%d: Unexpected character `%s' in S-record file\n"),
+        abfd, lineno, buf);
       bfd_set_error (bfd_error_bad_value);
     }
 }
@@ -564,11 +564,11 @@ srec_scan (abfd)
                bytes -= 2;
 
                if (sec != NULL
-                   && sec->vma + sec->_raw_size == address)
+                   && sec->vma + sec->size == address)
                  {
                    /* This data goes at the end of the section we are
                       currently building.  */
-                   sec->_raw_size += bytes;
+                   sec->size += bytes;
                  }
                else
                  {
@@ -586,7 +586,7 @@ srec_scan (abfd)
                    sec->flags = SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC;
                    sec->vma = address;
                    sec->lma = address;
-                   sec->_raw_size = bytes;
+                   sec->size = bytes;
                    sec->filepos = pos;
                  }
 
@@ -763,7 +763,7 @@ srec_read_section (abfd, section, contents)
       switch (hdr[0])
        {
        default:
-         BFD_ASSERT (sofar == section->_raw_size);
+         BFD_ASSERT (sofar == section->size);
          if (buf != NULL)
            free (buf);
          return TRUE;
@@ -788,7 +788,7 @@ srec_read_section (abfd, section, contents)
          if (address != section->vma + sofar)
            {
              /* We've come to the end of this section.  */
-             BFD_ASSERT (sofar == section->_raw_size);
+             BFD_ASSERT (sofar == section->size);
              if (buf != NULL)
                free (buf);
              return TRUE;
@@ -811,7 +811,7 @@ srec_read_section (abfd, section, contents)
   if (error)
     goto error_return;
 
-  BFD_ASSERT (sofar == section->_raw_size);
+  BFD_ASSERT (sofar == section->size);
 
   if (buf != NULL)
     free (buf);
@@ -836,8 +836,8 @@ srec_get_section_contents (abfd, section, location, offset, count)
 {
   if (section->used_by_bfd == NULL)
     {
-      section->used_by_bfd = bfd_alloc (abfd, section->_raw_size);
-      if (section->used_by_bfd == NULL && section->_raw_size != 0)
+      section->used_by_bfd = bfd_alloc (abfd, section->size);
+      if (section->used_by_bfd == NULL && section->size != 0)
        return FALSE;
 
       if (! srec_read_section (abfd, section, section->used_by_bfd))
@@ -872,7 +872,7 @@ static bfd_boolean
 srec_set_section_contents (abfd, section, location, offset, bytes_to_do)
      bfd *abfd;
      sec_ptr section;
-     PTR location;
+     const PTR location;
      file_ptr offset;
      bfd_size_type bytes_to_do;
 {
@@ -1009,7 +1009,7 @@ srec_write_header (abfd)
 {
   unsigned int len = strlen (abfd->filename);
 
-  /* I'll put an arbitary 40 char limit on header size.  */
+  /* I'll put an arbitrary 40 char limit on header size.  */
   if (len > 40)
     len = 40;
 
@@ -1095,24 +1095,25 @@ srec_write_symbols (abfd)
              && (s->flags & BSF_DEBUGGING) == 0)
            {
              /* Just dump out non debug symbols.  */
-             char buf[42], *p;
+             char buf[43], *p;
 
              len = strlen (s->name);
              if (bfd_bwrite ("  ", (bfd_size_type) 2, abfd) != 2
                  || bfd_bwrite (s->name, len, abfd) != len)
                return FALSE;
 
-             sprintf_vma (buf + 1, (s->value
+             sprintf_vma (buf + 2, (s->value
                                     + s->section->output_section->lma
                                     + s->section->output_offset));
-             p = buf + 1;
+             p = buf + 2;
              while (p[0] == '0' && p[1] != 0)
                p++;
              len = strlen (p);
              p[len] = '\r';
              p[len + 1] = '\n';
+             *--p = '$';
              *--p = ' ';
-             len += 3;
+             len += 4;
              if (bfd_bwrite (p, len, abfd) != len)
                return FALSE;
            }
@@ -1187,7 +1188,7 @@ srec_get_symtab_upper_bound (abfd)
 /* Return the symbol table.  */
 
 static long
-srec_get_symtab (abfd, alocation)
+srec_canonicalize_symtab (abfd, alocation)
      bfd *abfd;
      asymbol **alocation;
 {
@@ -1203,7 +1204,7 @@ srec_get_symtab (abfd, alocation)
 
       csymbols = (asymbol *) bfd_alloc (abfd, symcount * sizeof (asymbol));
       if (csymbols == NULL && symcount != 0)
-       return (long) FALSE;
+       return 0;
       abfd->tdata.srec_data->csymbols = csymbols;
 
       for (s = abfd->tdata.srec_data->symbols, c = csymbols;
@@ -1261,6 +1262,7 @@ srec_print_symbol (abfd, afile, symbol, how)
 #define srec_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
 #define srec_new_section_hook _bfd_generic_new_section_hook
 
+#define srec_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
 #define srec_bfd_is_local_label_name bfd_generic_is_local_label_name
 #define srec_get_lineno _bfd_nosymbols_get_lineno
 #define srec_find_nearest_line _bfd_nosymbols_find_nearest_line
@@ -1283,7 +1285,10 @@ srec_print_symbol (abfd, afile, symbol, how)
 #define srec_bfd_relax_section bfd_generic_relax_section
 #define srec_bfd_gc_sections bfd_generic_gc_sections
 #define srec_bfd_merge_sections bfd_generic_merge_sections
+#define srec_bfd_is_group_section bfd_generic_is_group_section
 #define srec_bfd_discard_group bfd_generic_discard_group
+#define srec_section_already_linked \
+  _bfd_generic_section_already_linked
 #define srec_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
 #define srec_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
 #define srec_bfd_link_add_symbols _bfd_generic_link_add_symbols
This page took 0.026833 seconds and 4 git commands to generate.