*** empty log message ***
authorSteve Chamberlain <steve@cygnus>
Fri, 7 Jun 1991 01:32:45 +0000 (01:32 +0000)
committerSteve Chamberlain <steve@cygnus>
Fri, 7 Jun 1991 01:32:45 +0000 (01:32 +0000)
bfd/ChangeLog
bfd/oasys.c
bfd/srec.c
ld/ldlang.c

index e025aad4859b0a93c0309359dd6c8085e9a1fa82..b1310b81a5dcd770c8b7be505a2a6ac4e9d17a64 100644 (file)
@@ -1,3 +1,10 @@
+Thu Jun  6 18:27:38 1991  Steve Chamberlain  (steve at cygint.cygnus.com)
+
+       * ../include/oasys.h oasys.c (oasys_archive_p): fixed so it works
+       
+       * srec.c: now allows any number of sections to be created in a
+       file. Outputs addresses of the right length.
+
 Thu May 30 15:30:10 1991  Steve Chamberlain  (steve at cygint.cygnus.com)
 
        * bfd.c (bfd_check_format): Fixed problem where when a defaulted
index 68218b2900f42b20d515637a2afe4a776b6587d0..4719273ad11ca29dfcc29366e8dd271d4f55176f 100644 (file)
@@ -216,7 +216,7 @@ DEFUN(oasys_archive_p,(abfd),
   oasys_archive_header_type header;
   oasys_external_archive_header_type header_ext;
   unsigned int i;
-  
+  file_ptr filepos;  
   bfd_seek(abfd, (file_ptr) 0, false);
 
   
@@ -256,6 +256,7 @@ DEFUN(oasys_archive_p,(abfd),
        (oasys_module_info_type*)
          bfd_alloc(abfd, sizeof(oasys_module_info_type) * header.mod_count);
 
+
       oasys_module_table_type record;
       oasys_external_module_table_type record_ext;
 
@@ -263,23 +264,34 @@ DEFUN(oasys_archive_p,(abfd),
       ar->module = module;
       ar->module_count = header.mod_count;
 
-      bfd_seek(abfd , header.mod_tbl_offset, SEEK_SET);
+
+      filepos = header.mod_tbl_offset;
       for (i = 0; i < header.mod_count; i++) {
+        bfd_seek(abfd , filepos, SEEK_SET);
        bfd_read((PTR)&record_ext, 1, sizeof(record_ext), abfd);
        
        record.mod_size = bfd_h_get_32(abfd, record_ext.mod_size);
-       record.file_offset = bfd_h_get_32(abfd, record_ext.file_offset);
-       record.mod_name_length = bfd_h_get_32(abfd, record_ext.mod_name_length);
+       record.file_offset = bfd_h_get_32(abfd,
+                                         record_ext.file_offset);
+
+       record.dep_count = bfd_h_get_32(abfd, record_ext.dep_count);
+       record.depee_count = bfd_h_get_32(abfd, record_ext.depee_count);
+       record.sect_count = bfd_h_get_32(abfd, record_ext.sect_count);
+
+
+       module[i].name = bfd_alloc(abfd,33);
 
-       module[i].name = bfd_alloc(abfd,record.mod_name_length+1);
+       memcpy(module[i].name, record_ext.mod_name, 33);
+       filepos +=
+         sizeof(record_ext) + 
+           record.dep_count * 4 +
+             record.depee_count * 4 +
+               record.sect_count * 8 + 187,
 
-       bfd_read(module[i].name, 1, record.mod_name_length +1, abfd);
-       /* SKip some stuff */
-       bfd_seek(abfd, record.dep_count * sizeof(int32_type),
-                SEEK_CUR);
 
        module[i].size = record.mod_size;
        module[i].pos = record.file_offset;
+       module[i].abfd = 0;
       }
       
     }
index 2cbc8ca8b7a3bb2283d0c82fb1ebdabe574dca9e..aef929bc6c59f11ee3bd96f62e46bbb389d73bf2 100644 (file)
@@ -104,11 +104,12 @@ typedef struct
   } u;
 } srec_type;
 
-
+#define enda(x) (x->vma + x->size)
 /* 
    called once per input srecord, used to work out vma and size of data.
  */
 
+static bfd_vma low,high;
 static void
 size_srec(abfd, section, address, raw, length)
 bfd *abfd;
@@ -117,13 +118,13 @@ bfd_vma address;
 byte_as_two_char_type *raw;
 unsigned int length;
 {
-  if (address < section->vma)
-    section->vma = address;
-
-  if (address + length  > section->vma + section->size)
-    section->size = (address+length) -  section->vma;
+  if (address < low)
+    low = address;
+  if (address + length > high) 
+    high = address + length;
 }
 
+
 /*
  called once per input srecord, copies data from input into bfd_alloc'd area
  */
@@ -228,8 +229,11 @@ bfd *abfd;
   section =  bfd_make_section(abfd, ".text");
   section->size = 0;
   section->vma = 0xffffffff;
+  low = 0xffffffff;
+  high = 0;
   pass_over(abfd, size_srec, section);
-
+  section->size = high - low;
+  section->vma = low;
   return abfd->xvec;
 }
 
@@ -286,9 +290,9 @@ int bytes_to_do;
   unsigned int i;
   srec_type buffer;
   bytes_written = 0;
-  if (section->size <= 0xffff) 
+  if (section->vma <= 0xffff) 
     type = 1;
-  else if (section->size <= 0xffffff) 
+  else if (section->vma <= 0xffffff) 
     type = 2;
   else
     type = 3;
@@ -368,14 +372,22 @@ DEFUN(srec_sizeof_headers,(abfd, exec),
 return 0;
 }
 
+static asymbol *
+DEFUN(srec_make_empty_symbol, (abfd),
+      bfd*abfd)
+{
+  asymbol *new=  (asymbol *)bfd_zalloc (abfd, sizeof (asymbol));
+  new->the_bfd = abfd;
+  return new;
+}
 /*SUPPRESS 460 */
 
-#define srec_new_section_hook (PROTO(boolean, (*), (bfd *, asection *)))bfd_false
+#define srec_new_section_hook (PROTO(boolean, (*), (bfd *, asection *)))bfd_true
 #define srec_get_symtab_upper_bound bfd_false
 #define srec_get_symtab (PROTO(unsigned int, (*), (bfd *, asymbol **)))bfd_0
 #define srec_get_reloc_upper_bound (PROTO(unsigned int, (*),(bfd*, asection *)))bfd_false
 #define srec_canonicalize_reloc (PROTO(unsigned int, (*),(bfd*,asection *, arelent **, asymbol **))) bfd_0
-#define srec_make_empty_symbol (PROTO(asymbol *,(*),(bfd*))) bfd_nullvoidptr
+
 #define srec_print_symbol (PROTO(void,(*),(bfd *, PTR, asymbol *, bfd_print_symbol_enum_type))) bfd_void
 
 #define srec_openr_next_archived_file (PROTO(bfd *, (*), (bfd*,bfd*))) bfd_nullvoidptr
index cabcf9de192bc6e935543522dcac815e15030d8c..00d1e168d6b2bdf9d95f6a914ee8203be34c3aee 100644 (file)
@@ -486,6 +486,11 @@ DEFUN(init_os,(s),
       ldmalloc((bfd_size_type)(sizeof(section_userdata_type)));
 
   s->bfd_section = bfd_make_section(output_bfd, s->name);
+  if (s->bfd_section == (asection *)NULL) {
+    info("%P%F output format %s cannot represent section called %s\n",
+        output_bfd->xvec->name,
+        s->name);
+  }
   s->bfd_section->output_section = s->bfd_section;
   s->bfd_section->flags = SEC_NO_FLAGS;
   /* We initialize an output sections output offset to minus its own */
This page took 0.035119 seconds and 4 git commands to generate.