diff options
author | Steve Chamberlain <steve@cygnus> | 1991-06-07 01:32:45 +0000 |
---|---|---|
committer | Steve Chamberlain <steve@cygnus> | 1991-06-07 01:32:45 +0000 |
commit | 357a1f38a539d43612122eb1c1842fd84859b165 (patch) | |
tree | a1cf61527f416bab396b7348df5218ee86756540 | |
parent | 50a52c1a15d2bf6cf3d8c6355e833d5dba07d63a (diff) | |
download | gdb-357a1f38a539d43612122eb1c1842fd84859b165.zip gdb-357a1f38a539d43612122eb1c1842fd84859b165.tar.gz gdb-357a1f38a539d43612122eb1c1842fd84859b165.tar.bz2 |
*** empty log message ***
-rw-r--r-- | bfd/ChangeLog | 7 | ||||
-rw-r--r-- | bfd/oasys.c | 30 | ||||
-rw-r--r-- | bfd/srec.c | 34 | ||||
-rw-r--r-- | ld/ldlang.c | 5 |
4 files changed, 56 insertions, 20 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index e025aad..b1310b8 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -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 diff --git a/bfd/oasys.c b/bfd/oasys.c index 68218b2..4719273 100644 --- a/bfd/oasys.c +++ b/bfd/oasys.c @@ -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; } } @@ -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 diff --git a/ld/ldlang.c b/ld/ldlang.c index cabcf9de..00d1e16 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -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 */ |