diff options
author | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1996-06-10 10:55:58 +0000 |
---|---|---|
committer | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1996-06-10 10:55:58 +0000 |
commit | a7e831079363e3bb45f3172f6e59ba48e335682b (patch) | |
tree | ee4324eac9a9d66f189fab60498ec42b8226b7fc /gnu/usr.bin/binutils/bfd/srec.c | |
parent | 467cb0a471d13c5186a6ee166e60b47c30da64e9 (diff) |
Bring Cygnus versions into the trunk, keeping our local patches
Diffstat (limited to 'gnu/usr.bin/binutils/bfd/srec.c')
-rw-r--r-- | gnu/usr.bin/binutils/bfd/srec.c | 71 |
1 files changed, 31 insertions, 40 deletions
diff --git a/gnu/usr.bin/binutils/bfd/srec.c b/gnu/usr.bin/binutils/bfd/srec.c index 5f274c67cab..393dd035b6b 100644 --- a/gnu/usr.bin/binutils/bfd/srec.c +++ b/gnu/usr.bin/binutils/bfd/srec.c @@ -208,10 +208,7 @@ srec_mkobject (abfd) { tdata_type *tdata = (tdata_type *) bfd_alloc (abfd, sizeof (tdata_type)); if (tdata == NULL) - { - bfd_set_error (bfd_error_no_memory); - return false; - } + return false; abfd->tdata.srec_data = tdata; tdata->type = 1; tdata->head = NULL; @@ -290,10 +287,7 @@ srec_new_symbol (abfd, name, val) n = (struct srec_symbol *) bfd_alloc (abfd, sizeof (struct srec_symbol)); if (n == NULL) - { - bfd_set_error (bfd_error_no_memory); - return false; - } + return false; n->name = name; n->val = val; @@ -467,12 +461,9 @@ srec_scan (abfd) { if (buf != NULL) free (buf); - buf = (bfd_byte *) malloc (bytes * 2); + buf = (bfd_byte *) bfd_malloc (bytes * 2); if (buf == NULL) - { - bfd_set_error (bfd_error_no_memory); - goto error_return; - } + goto error_return; bufsize = bytes * 2; } @@ -530,6 +521,7 @@ srec_scan (abfd) goto error_return; sec->flags = SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC; sec->vma = address; + sec->lma = address; sec->_raw_size = bytes; sec->filepos = pos; } @@ -673,12 +665,9 @@ srec_read_section (abfd, section, contents) { if (buf != NULL) free (buf); - buf = (bfd_byte *) malloc (bytes * 2); + buf = (bfd_byte *) bfd_malloc (bytes * 2); if (buf == NULL) - { - bfd_set_error (bfd_error_no_memory); - goto error_return; - } + goto error_return; bufsize = bytes * 2; } @@ -766,10 +755,7 @@ srec_get_section_contents (abfd, section, location, offset, count) section->used_by_bfd = bfd_alloc (abfd, section->_raw_size); if (section->used_by_bfd == NULL && section->_raw_size != 0) - { - bfd_set_error (bfd_error_no_memory); - return false; - } + return false; if (! srec_read_section (abfd, section, section->used_by_bfd)) return false; @@ -781,6 +767,22 @@ srec_get_section_contents (abfd, section, location, offset, count) return true; } +/* Set the architecture. We accept an unknown architecture here. */ + +static boolean +srec_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); +} + /* we have to save up all the Srecords for a splurge before output */ static boolean @@ -797,10 +799,7 @@ srec_set_section_contents (abfd, section, location, offset, bytes_to_do) entry = ((srec_data_list_type *) bfd_alloc (abfd, sizeof (srec_data_list_type))); if (entry == NULL) - { - bfd_set_error (bfd_error_no_memory); - return false; - } + return false; if (bytes_to_do && (section->flags & SEC_ALLOC) @@ -808,10 +807,7 @@ srec_set_section_contents (abfd, section, location, offset, bytes_to_do) { bfd_byte *data = (bfd_byte *) bfd_alloc (abfd, bytes_to_do); if (data == NULL) - { - bfd_set_error (bfd_error_no_memory); - return false; - } + return false; memcpy ((PTR) data, location, (size_t) bytes_to_do); if ((section->lma + offset + bytes_to_do - 1) <= 0xffff) @@ -1149,10 +1145,7 @@ srec_get_symtab (abfd, alocation) csymbols = (asymbol *) bfd_alloc (abfd, symcount * sizeof (asymbol)); if (csymbols == NULL && symcount != 0) - { - bfd_set_error (bfd_error_no_memory); - return false; - } + return false; abfd->tdata.srec_data->csymbols = csymbols; for (s = abfd->tdata.srec_data->symbols, c = csymbols; @@ -1228,8 +1221,6 @@ srec_print_symbol (ignore_abfd, afile, symbol, how) #define srec_get_section_contents_in_window \ _bfd_generic_get_section_contents_in_window -#define srec_set_arch_mach bfd_default_set_arch_mach - #define srec_bfd_get_relocated_section_contents \ bfd_generic_get_relocated_section_contents #define srec_bfd_relax_section bfd_generic_relax_section @@ -1242,8 +1233,8 @@ const bfd_target srec_vec = { "srec", /* name */ bfd_target_srec_flavour, - true, /* target byte order */ - true, /* target headers byte order */ + BFD_ENDIAN_UNKNOWN, /* target byte order */ + BFD_ENDIAN_UNKNOWN, /* target headers byte order */ (HAS_RELOC | EXEC_P | /* object flags */ HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED), @@ -1297,8 +1288,8 @@ const bfd_target symbolsrec_vec = { "symbolsrec", /* name */ bfd_target_srec_flavour, - true, /* target byte order */ - true, /* target headers byte order */ + BFD_ENDIAN_UNKNOWN, /* target byte order */ + BFD_ENDIAN_UNKNOWN, /* target headers byte order */ (HAS_RELOC | EXEC_P | /* object flags */ HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED), |