+ filepos = header.mod_tbl_offset;
+ for (i = 0; i < header.mod_count; i++)
+ {
+ if (bfd_seek (abfd, filepos, SEEK_SET) != 0)
+ return NULL;
+
+ /* There are two ways of specifying the archive header */
+
+ if (0)
+ {
+ oasys_extmodule_table_type_a_type record_ext;
+ if (bfd_read ((PTR) & record_ext, 1, sizeof (record_ext), abfd)
+ != sizeof (record_ext))
+ return NULL;
+
+ 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.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);
+ if (!module[i].name)
+ return NULL;
+
+ 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;
+ }
+ else
+ {
+ oasys_extmodule_table_type_b_type record_ext;
+ if (bfd_read ((PTR) & record_ext, 1, sizeof (record_ext), abfd)
+ != sizeof (record_ext))
+ return NULL;
+
+ 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.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);
+ record.module_name_size = bfd_h_get_32 (abfd, record_ext.mod_name_length);
+
+ module[i].name = bfd_alloc (abfd, record.module_name_size + 1);
+ if (!module[i].name)
+ return NULL;
+ if (bfd_read ((PTR) module[i].name, 1, record.module_name_size,
+ abfd)
+ != record.module_name_size)
+ return NULL;
+ module[i].name[record.module_name_size] = 0;
+ filepos +=
+ sizeof (record_ext) +
+ record.dep_count * 4 +
+ record.module_name_size + 1;
+
+ }