bfd *abfd;
bfd_byte byte;
{
- bfd_write ((PTR) & byte, 1, 1, abfd);
+ if (bfd_write ((PTR) & byte, 1, 1, abfd) != 1)
+ abort ();
}
static void
bfd_byte b[2];
b[1] = twobyte & 0xff;
b[0] = twobyte >> 8;
- bfd_write ((PTR) & b[0], 1, 2, abfd);
+ if (bfd_write ((PTR) & b[0], 1, 2, abfd) != 2)
+ abort ();
}
static void
buffer[0] = bytes >> 8;
buffer[1] = bytes & 0xff;
- bfd_write ((PTR) buffer, 1, 2, abfd);
+ if (bfd_write ((PTR) buffer, 1, 2, abfd) != 2)
+ abort ();
}
static void
{
BFD_FAIL ();
}
- bfd_write ((PTR) id, 1, length, abfd);
+ if (bfd_write ((PTR) id, 1, length, abfd) != length)
+ abort ();
}
\f
{
bfd_byte b[5];
ieee_write_int5 (b, value);
- bfd_write ((PTR) b, 1, 5, abfd);
+ if (bfd_write ((PTR) b, 1, 5, abfd) != 5)
+ abort ();
}
static boolean
symbol index order
*/
-extern bfd_target ieee_vec;
+extern const bfd_target ieee_vec;
long
ieee_get_symtab (abfd, location)
* archive stuff
*/
-bfd_target *
+const bfd_target *
ieee_archive_p (abfd)
bfd *abfd;
{
}
ieee = IEEE_AR_DATA (abfd);
+ /* FIXME: Check return value. I'm not sure whether it needs to read
+ the entire buffer or not. */
bfd_read ((PTR) buffer, 1, sizeof (buffer), abfd);
ieee->h.first_byte = buffer;
if (this_byte (&(ieee->h)) != Module_Beginning)
{
abfd->tdata.ieee_ar_data = save;
- return (bfd_target *) NULL;
+ return (const bfd_target *) NULL;
}
next_byte (&(ieee->h));
{
bfd_release (abfd, ieee);
abfd->tdata.ieee_ar_data = save;
- return (bfd_target *) NULL;
+ return (const bfd_target *) NULL;
}
/* Throw away the filename */
read_id (&(ieee->h));
if (!obstack_begin (&ob, 128))
{
bfd_set_error (bfd_error_no_memory);
- return (bfd_target *) NULL;
+ return (const bfd_target *) NULL;
}
ieee->element_count = 0;
{
/* Past half way, reseek and reprime */
buffer_offset += ieee_pos (abfd);
- bfd_seek (abfd, buffer_offset, SEEK_SET);
+ if (bfd_seek (abfd, buffer_offset, SEEK_SET) != 0)
+ return NULL;
+ /* FIXME: Check return value. I'm not sure whether it
+ needs to read the entire buffer or not. */
bfd_read ((PTR) buffer, 1, sizeof (buffer), abfd);
ieee->h.first_byte = buffer;
ieee->h.input_p = buffer;
if (!ieee->elements)
{
bfd_set_error (bfd_error_no_memory);
- return (bfd_target *) NULL;
+ return (const bfd_target *) NULL;
}
/* Now scan the area again, and replace BB offsets with file */
for (i = 2; i < ieee->element_count; i++)
{
- bfd_seek (abfd, ieee->elements[i].file_offset, SEEK_SET);
+ if (bfd_seek (abfd, ieee->elements[i].file_offset, SEEK_SET) != 0)
+ return NULL;
+ /* FIXME: Check return value. I'm not sure whether it needs to
+ read the entire buffer or not. */
bfd_read ((PTR) buffer, 1, sizeof (buffer), abfd);
ieee->h.first_byte = buffer;
ieee->h.input_p = buffer;
return abfd->tdata.ieee_data ? true : false;
}
-bfd_target *
+const bfd_target *
ieee_object_p (abfd)
bfd *abfd;
{
ieee_mkobject (abfd);
ieee = IEEE_DATA (abfd);
- bfd_seek (abfd, (file_ptr) 0, SEEK_SET);
+ if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
+ goto fail;
/* Read the first few bytes in to see if it makes sense */
+ /* FIXME: Check return value. I'm not sure whether it needs to read
+ the entire buffer or not. */
bfd_read ((PTR) buffer, 1, sizeof (buffer), abfd);
ieee->h.input_p = buffer;
if (this_byte_and_next (&(ieee->h)) != Module_Beginning)
- goto fail;
+ goto got_wrong_format;
ieee->read_symbols = false;
ieee->read_data = false;
processor = ieee->mb.processor = read_id (&(ieee->h));
if (strcmp (processor, "LIBRARY") == 0)
- goto fail;
+ goto got_wrong_format;
ieee->mb.module_name = read_id (&(ieee->h));
if (abfd->filename == (CONST char *) NULL)
{
{
bfd_arch_info_type *arch = bfd_scan_arch (processor);
if (arch == 0)
- goto fail;
+ goto got_wrong_format;
abfd->arch_info = arch;
}
bfd_set_error (bfd_error_no_memory);
goto fail;
}
- bfd_seek (abfd, (file_ptr) 0, SEEK_SET);
+ if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
+ goto fail;
+ /* FIXME: Check return value. I'm not sure whether it needs to read
+ the entire buffer or not. */
bfd_read ((PTR) (IEEE_DATA (abfd)->h.first_byte), 1, ieee->w.r.me_record + 50, abfd);
ieee_slurp_sections (abfd);
return abfd->xvec;
+got_wrong_format:
+ bfd_set_error (bfd_error_wrong_format);
fail:
(void) bfd_release (abfd, ieee);
abfd->tdata.ieee_data = save;
- return (bfd_target *) NULL;
+ return (const bfd_target *) NULL;
}
void
ieee_write_byte (abfd, ieee_load_constant_bytes_enum);
/* Output a stream of bytes */
ieee_write_int (abfd, run);
- bfd_write ((PTR) (stream + current_byte_index),
- 1,
- run,
- abfd);
+ if (bfd_write ((PTR) (stream + current_byte_index),
+ 1,
+ run,
+ abfd)
+ != run)
+ return false;
current_byte_index += run;
}
}
{
/* Output a stream of bytes */
ieee_write_int (abfd, run);
- bfd_write ((PTR) (stream + current_byte_index),
- 1,
- run,
- abfd);
+ if (bfd_write ((PTR) (stream + current_byte_index),
+ 1,
+ run,
+ abfd)
+ != run)
+ return false;
current_byte_index += run;
}
/* Output any relocations here */
static void
fill ()
{
+ /* FIXME: Check return value. I'm not sure whether it needs to read
+ the entire buffer or not. */
bfd_read ((PTR) input_ptr_start, 1, input_ptr_end - input_ptr_start, input_bfd);
input_ptr = input_ptr_start;
}
static void
flush ()
{
- bfd_write ((PTR) (output_ptr_start), 1, output_ptr - output_ptr_start, output_bfd);
+ if (bfd_write ((PTR) (output_ptr_start), 1, output_ptr - output_ptr_start,
+ output_bfd)
+ != output_ptr - output_ptr_start)
+ abort ();
output_ptr = output_ptr_start;
output_buffer++;
}
input_ptr_start = input_ptr = input_buffer;
input_ptr_end = input_buffer + IBS;
input_bfd = input;
+ /* FIXME: Check return value. I'm not sure whether it needs to read
+ the entire buffer or not. */
bfd_read ((PTR) input_ptr_start, 1, IBS, input);
block ();
}
ieee_data_type *entry_ieee = IEEE_DATA (entry);
if (entry_ieee->w.r.debug_information_part)
{
- bfd_seek (entry, entry_ieee->w.r.debug_information_part, SEEK_SET);
+ if (bfd_seek (entry, entry_ieee->w.r.debug_information_part,
+ SEEK_SET)
+ != 0)
+ abort ();
relocate_debug (abfd, entry);
}
unsigned int i;
file_ptr old;
/* Fast forward over the header area */
- bfd_seek (abfd, (file_ptr) 0, SEEK_SET);
+ if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
+ return false;
ieee_write_byte (abfd, ieee_module_beginning_enum);
ieee_write_id (abfd, bfd_printable_name (abfd));
(bfd_byte) (bfd_arch_bits_per_address (abfd) / bfd_arch_bits_per_byte (abfd)));
old = bfd_tell (abfd);
- bfd_seek (abfd, (file_ptr) (8 * N_W_VARIABLES), SEEK_CUR);
+ if (bfd_seek (abfd, (file_ptr) (8 * N_W_VARIABLES), SEEK_CUR) != 0)
+ return false;
ieee->w.r.extension_record = bfd_tell (abfd);
- bfd_write ((char *) exten, 1, sizeof (exten), abfd);
+ if (bfd_write ((char *) exten, 1, sizeof (exten), abfd) != sizeof (exten))
+ return false;
if (abfd->flags & EXEC_P)
ieee_write_byte (abfd, 0x1);/* Absolute */
else
ieee_write_byte (abfd, 0x2);/* Relocateable */
ieee->w.r.environmental_record = bfd_tell (abfd);
- bfd_write ((char *) envi, 1, sizeof (envi), abfd);
+ if (bfd_write ((char *) envi, 1, sizeof (envi), abfd) != sizeof (envi))
+ return false;
output_bfd = abfd;
flush ();
/* Generate the header */
- bfd_seek (abfd, old, SEEK_SET);
+ if (bfd_seek (abfd, old, SEEK_SET) != 0)
+ return false;
for (i = 0; i < N_W_VARIABLES; i++)
{
}
+/* The debug info routines are never used. */
+#if 0
+
static void
ieee_bfd_debug_info_start (abfd)
bfd *abfd;
}
}
+#endif
+
+#define ieee_close_and_cleanup _bfd_generic_close_and_cleanup
+#define ieee_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
-#define FOO PROTO
-#define ieee_core_file_failing_command (char *(*)())(bfd_nullvoidptr)
-#define ieee_core_file_failing_signal (int (*)())bfd_0
-#define ieee_core_file_matches_executable_p ( FOO(boolean, (*),(bfd *, bfd *)))bfd_false
#define ieee_slurp_armap bfd_true
#define ieee_slurp_extended_name_table bfd_true
-#define ieee_truncate_arname (void (*)())bfd_nullvoidptr
-#define ieee_write_armap (FOO( boolean, (*),(bfd *, unsigned int, struct orl *, unsigned int, int))) bfd_nullvoidptr
-#define ieee_get_lineno (struct lineno_cache_entry *(*)())bfd_nullvoidptr
-#define ieee_close_and_cleanup bfd_generic_close_and_cleanup
-#define ieee_set_arch_mach bfd_default_set_arch_mach
-#define ieee_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents
+#define ieee_truncate_arname bfd_dont_truncate_arname
+#define ieee_write_armap \
+ ((boolean (*) \
+ PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int))) \
+ bfd_true)
+
+#define ieee_bfd_is_local_label bfd_generic_is_local_label
+#define ieee_get_lineno _bfd_nosymbols_get_lineno
+#define ieee_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
+
+#define ieee_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup
+
+#define ieee_set_arch_mach _bfd_generic_set_arch_mach
+
+#define ieee_bfd_get_relocated_section_contents \
+ bfd_generic_get_relocated_section_contents
#define ieee_bfd_relax_section bfd_generic_relax_section
-#define ieee_bfd_reloc_type_lookup \
- ((CONST struct reloc_howto_struct *(*) PARAMS ((bfd *, bfd_reloc_code_real_type))) bfd_nullvoidptr)
-#define ieee_bfd_make_debug_symbol \
- ((asymbol *(*) PARAMS ((bfd *, void *, unsigned long))) bfd_nullvoidptr)
#define ieee_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
#define ieee_bfd_link_add_symbols _bfd_generic_link_add_symbols
#define ieee_bfd_final_link _bfd_generic_final_link
-#define ieee_bfd_copy_private_section_data \
- ((boolean (*) PARAMS ((bfd *, asection *, bfd *, asection *))) bfd_true)
-#define ieee_bfd_copy_private_bfd_data \
- ((boolean (*) PARAMS ((bfd *, bfd *))) bfd_true)
-#define ieee_bfd_is_local_label bfd_generic_is_local_label
-#define ieee_bfd_free_cached_info bfd_true
/*SUPPRESS 460 */
-bfd_target ieee_vec =
+const bfd_target ieee_vec =
{
"ieee", /* name */
bfd_target_ieee_flavour,
_bfd_write_archive_contents,
bfd_false,
},
- JUMP_TABLE (ieee),
+
+ BFD_JUMP_TABLE_GENERIC (ieee),
+ BFD_JUMP_TABLE_COPY (_bfd_generic),
+ BFD_JUMP_TABLE_CORE (_bfd_nocore),
+ BFD_JUMP_TABLE_ARCHIVE (ieee),
+ BFD_JUMP_TABLE_SYMBOLS (ieee),
+ BFD_JUMP_TABLE_RELOCS (ieee),
+ BFD_JUMP_TABLE_WRITE (ieee),
+ BFD_JUMP_TABLE_LINK (ieee),
+ BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
+
(PTR) 0
};