transfer vector changes. See ChangeLog.
bfd_generic_archive_p, _bfd_dummy_target},
{bfd_false, coff_mkobject, /* bfd_set_format */
_bfd_generic_mkarchive, bfd_false},
-
+ {bfd_false, coff_write_object_contents, /* bfd_write_contents */
+ _bfd_write_archive_contents, bfd_false},
JUMP_TABLE(coff)
};
-
-
bfd_target icoff_big_vec =
{
"coff-Intel-big", /* name */
_do_getllong, _do_putllong, _do_getlshort, _do_putlshort, /* data */
_do_getblong, _do_putblong, _do_getbshort, _do_putbshort, /* hdrs */
- {_bfd_dummy_target, coff_object_p, bfd_generic_archive_p, _bfd_dummy_target},
- {bfd_false, coff_mkobject, _bfd_generic_mkarchive, bfd_false},
-
+ {_bfd_dummy_target, coff_object_p, /* bfd_check_format */
+ bfd_generic_archive_p, _bfd_dummy_target},
+ {bfd_false, coff_mkobject, /* bfd_set_format */
+ _bfd_generic_mkarchive, bfd_false},
+ {bfd_false, coff_write_object_contents, /* bfd_write_contents */
+ _bfd_write_archive_contents, bfd_false},
JUMP_TABLE(coff)
};
-
bfd_generic_archive_p, _bfd_dummy_target},
{bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */
bfd_false},
+ {bfd_false, coff_write_object_contents, /* bfd_write_contents */
+ _bfd_write_archive_contents, bfd_false},
- JUMP_TABLE(coff)
-
- };
-
-
-
+ JUMP_TABLE(coff)
+};
return 0;
}
\f
-
-/* ARGSUSED */
-boolean
-ecoff_close_and_cleanup (abfd)
- bfd *abfd;
-{
- return false;
-}
-\f
/* ARGSUSED */
static boolean
ecoff_slurp_symbol_table(abfd)
#define ecoff_core_file_failing_command _bfd_dummy_core_file_failing_command
#define ecoff_core_file_failing_signal _bfd_dummy_core_file_failing_signal
#define ecoff_core_file_matches_executable_p _bfd_dummy_core_file_matches_executable_p
+
+/* Archives not supported yet. FIXME. */
#define ecoff_slurp_armap bfd_false
#define ecoff_slurp_extended_name_table bfd_false
-#define ecoff_truncate_arname bfd_void
+#define ecoff_truncate_arname bfd_dont_truncate_arname
#define ecoff_write_armap bfd_false
+#define ecoff_openr_next_archived_file bfd_generic_openr_next_archived_file
+#define ecoff_generic_stat_arch_elt bfd_generic_stat_arch_elt
+
+/* Unimplemented routines. FIXME. */
#define ecoff_print_symbol bfd_void
#define ecoff_set_arch_mach bfd_false
-#define ecoff_openr_next_archived_file bfd_generic_openr_next_archived_file
#define ecoff_find_nearest_line bfd_false
-#define ecoff_generic_stat_arch_elt bfd_generic_stat_arch_elt
#define ecoff_sizeof_headers bfd_0
+/* We use the generic BFD version of these. */
+#define ecoff_close_and_cleanup bfd_generic_close_and_cleanup
+
bfd_target ecoff_little_vec =
{"ecoff-littlemips", /* name */
- bfd_target_coff_flavour_enum,
- false, /* data byte order is little */
- false, /* header byte order is little */
+ bfd_target_coff_flavour_enum,
+ false, /* data byte order is little */
+ false, /* header byte order is little */
- (HAS_RELOC | EXEC_P | /* object flags */
- HAS_LINENO | HAS_DEBUG |
- HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT),
+ (HAS_RELOC | EXEC_P | /* object flags */
+ HAS_LINENO | HAS_DEBUG |
+ HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT),
- (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
- '/', /* ar_pad_char */
- 15, /* ar_max_namelen */
- _do_getllong, _do_putllong, _do_getlshort, _do_putlshort, /* data */
- _do_getllong, _do_putllong, _do_getlshort, _do_putlshort, /* hdrs */
+ (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* sect flags */
+ '/', /* ar_pad_char */
+ 15, /* ar_max_namelen */
+ _do_getllong, _do_putllong, _do_getlshort, _do_putlshort, /* data */
+ _do_getllong, _do_putllong, _do_getlshort, _do_putlshort, /* hdrs */
- {_bfd_dummy_target, ecoff_object_p, /* bfd_check_format */
+ {_bfd_dummy_target, ecoff_object_p, /* bfd_check_format */
bfd_generic_archive_p, _bfd_dummy_target},
- {bfd_false, ecoff_mkobject, bfd_false, /* bfd_set_format */
+ {bfd_false, ecoff_mkobject, bfd_false, /* bfd_set_format */
bfd_false},
- JUMP_TABLE (ecoff)
+ {bfd_false, ecoff_write_object_contents, bfd_false, bfd_false},
+ JUMP_TABLE (ecoff)
};
bfd_target ecoff_big_vec =
{"ecoff-bigmips", /* name */
- bfd_target_coff_flavour_enum,
- true, /* data byte order is big */
- true, /* header byte order is big */
+ bfd_target_coff_flavour_enum,
+ true, /* data byte order is big */
+ true, /* header byte order is big */
- (HAS_RELOC | EXEC_P | /* object flags */
- HAS_LINENO | HAS_DEBUG |
- HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT),
+ (HAS_RELOC | EXEC_P | /* object flags */
+ HAS_LINENO | HAS_DEBUG |
+ HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT),
- (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
- ' ', /* ar_pad_char */
- 16, /* ar_max_namelen */
- _do_getblong, _do_putblong, _do_getbshort, _do_putbshort, /* data */
- _do_getblong, _do_putblong, _do_getbshort, _do_putbshort, /* hdrs */
+ (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* sect flags */
+ ' ', /* ar_pad_char */
+ 16, /* ar_max_namelen */
+ _do_getblong, _do_putblong, _do_getbshort, _do_putbshort, /* data */
+ _do_getblong, _do_putblong, _do_getbshort, _do_putbshort, /* hdrs */
- {_bfd_dummy_target, ecoff_object_p, /* bfd_check_format */
+ {_bfd_dummy_target, ecoff_object_p, /* bfd_check_format */
bfd_generic_archive_p, _bfd_dummy_target},
- {bfd_false, ecoff_mkobject, bfd_false, /* bfd_set_format */
+ {bfd_false, ecoff_mkobject, bfd_false, /* bfd_set_format */
bfd_false},
- JUMP_TABLE(ecoff)
+ {bfd_false, ecoff_write_object_contents, /* bfd_write_contents */
+ bfd_false, bfd_false},
+ JUMP_TABLE(ecoff)
};
void
-DEFUN(ieee_print_symbol,(ignore_abfd, file, symbol, how),
+DEFUN(ieee_print_symbol,(ignore_abfd, afile, symbol, how),
bfd *ignore_abfd AND
- FILE *file AND
+ PTR afile AND
asymbol *symbol AND
bfd_print_symbol_enum_type how)
{
+ FILE *file = (FILE *)afile;
+
switch (how) {
case bfd_print_symbol_name_enum:
fprintf(file,"%s", symbol->name);
}
-
-
-boolean
-ieee_close_and_cleanup (abfd)
-bfd *abfd;
-{
- if (bfd_read_p (abfd) == false)
- switch (abfd->format) {
- case bfd_archive:
- if (!_bfd_write_archive_contents (abfd)) {
- return false;
- }
- break;
- case bfd_object:
- if (!ieee_write_object_contents (abfd)) {
- return false;
- }
- break;
- default:
- bfd_error = invalid_operation;
- return false;
- }
-
-
- return true;
-}
-
static bfd *
ieee_openr_next_archived_file(arch, prev)
bfd *arch;
#define ieee_truncate_arname (void (*)())bfd_nullvoidptr
#define ieee_write_armap (PROTO( boolean, (*),(bfd *, unsigned int, struct orl *, int, int))) bfd_nullvoidptr
#define ieee_get_lineno (struct lineno_cache_entry *(*)())bfd_nullvoidptr
+#define ieee_close_and_cleanup bfd_generic_close_and_cleanup
/*SUPPRESS 460 */
_bfd_generic_mkarchive,
bfd_false
},
-JUMP_TABLE(ieee)
+ {
+ bfd_false,
+ ieee_write_object_contents,
+ _bfd_write_archive_contents,
+ bfd_false,
+ },
+ JUMP_TABLE(ieee)
};
static void
-DEFUN(oasys_print_symbol,(ignore_abfd, file, symbol, how),
+DEFUN(oasys_print_symbol,(ignore_abfd, afile, symbol, how),
bfd *ignore_abfd AND
- FILE *file AND
+ PTR afile AND
asymbol *symbol AND
bfd_print_symbol_enum_type how)
{
+ FILE *file = (FILE *)afile;
+
switch (how) {
case bfd_print_symbol_name_enum:
case bfd_print_symbol_type_enum:
DEFUN(oasys_get_section_contents,(abfd, section, location, offset, count),
bfd *abfd AND
sec_ptr section AND
- void *location AND
+ PTR location AND
file_ptr offset AND
- unsigned int count)
+ int count)
{
oasys_per_section_type *p = (oasys_per_section_type *) section->used_by_bfd;
oasys_slurp_section_data(abfd);
DEFUN(oasys_set_section_contents,(abfd, section, location, offset, count),
bfd *abfd AND
sec_ptr section AND
- unsigned char *location AND
+ PTR location AND
file_ptr offset AND
int count)
{
/* User should have checked the file flags; perhaps we should return
BFD_NO_MORE_SYMBOLS if there are none? */
-
-
-boolean
-oasys_close_and_cleanup (abfd)
-bfd *abfd;
-{
- if (bfd_read_p (abfd) == false)
- switch (abfd->format) {
- case bfd_archive:
- if (!_bfd_write_archive_contents (abfd)) {
- return false;
- }
- break;
- case bfd_object:
- if (!oasys_write_object_contents (abfd)) {
- return false;
- }
- break;
- default:
- bfd_error = invalid_operation;
- return false;
- }
-
-
-
- return true;
-}
-
static bfd *
oasys_openr_next_archived_file(arch, prev)
bfd *arch;
#define oasys_truncate_arname (void (*)())bfd_nullvoidptr
#define oasys_write_armap 0 /* (PROTO( boolean, (*),(bfd *, unsigned int, struct orl *, int, int))) bfd_nullvoidptr*/
#define oasys_get_lineno (struct lineno_cache_entry *(*)())bfd_nullvoidptr
-
+#define oasys_close_and_cleanup bfd_generic_close_and_cleanup
oasys_archive_p,
_bfd_dummy_target,
},
- {
+ { /* bfd_set_format */
bfd_false,
oasys_mkobject,
_bfd_generic_mkarchive,
bfd_false
},
-JUMP_TABLE(oasys)
+ { /* bfd_write_contents */
+ bfd_false,
+ oasys_write_object_contents,
+ _bfd_write_archive_contents,
+ bfd_false,
+ },
+ JUMP_TABLE(oasys)
};
bfd_close (abfd)
bfd *abfd;
{
+ if (!bfd_read_p(abfd))
+ if (BFD_SEND_FMT (abfd, _bfd_write_contents, (abfd)) != true)
+ return false;
+
if (BFD_SEND (abfd, _close_and_cleanup, (abfd)) != true) return false;
bfd_cache_close(abfd);
-/* If the file was open for writing and is now executable
- make it so */
+
+ /* If the file was open for writing and is now executable,
+ make it so */
if (abfd->direction == write_direction
&& abfd->flags & EXEC_P) {
struct stat buf;
chmod(abfd->filename,buf.st_mode | S_IXUSR | S_IXGRP | S_IXOTH);
}
(void) obstack_free (&abfd->memory, (PTR)0);
+ /* FIXME, shouldn't we de-allocate the bfd as well? */
return true;
}
only section we create. We arbitarily call this section ".text".
When bfd_get_section_contents is called the file is read again, and
- this time the data is placed into a malloced area.
+ this time the data is placed into a bfd_alloc'd area.
Any number of sections may be created for output, we just output them
in the order provided to bfd_set_section_contents.
/* $Id$
* $Log$
- * Revision 1.7 1991/05/08 19:21:47 steve
+ * Revision 1.8 1991/05/11 00:38:46 gnu
+ * Cleanups of interface, including close_and_cleanup and write_contents
+ * transfer vector changes. See ChangeLog.
+ *
+ * Revision 1.7 1991/05/08 19:21:47 steve
* Various portability lints.
* Fixed reloc bug in ieee and oasys.
*
}
/*
- called once per input srecord, copies data from input into malloced area
+ called once per input srecord, copies data from input into bfd_alloc'd area
*/
static void
unsigned int count;
{
if (section->used_by_bfd == (PTR)NULL) {
- section->used_by_bfd = (PTR)malloc(section->size);
+ section->used_by_bfd = (PTR)bfd_alloc (abfd, section->size);
pass_over(abfd, fillup, section);
}
(void) memcpy(location, (bfd_byte *)(section->used_by_bfd) + offset, count);
return true;
}
-
boolean
-srec_close_and_cleanup (abfd)
-bfd *abfd;
+srec_write_object_contents (abfd)
+ bfd *abfd;
{
- asection *s;
- if (bfd_read_p (abfd) == false) {
- switch (abfd->format) {
- case bfd_archive:
- if (!_bfd_write_archive_contents (abfd)) {
- return false;
- }
- break;
- case bfd_object:
- bfd_write("S9030000FC\n", 1,11,abfd);
- break;
- default:
- bfd_error = invalid_operation;
- return false;
- }
- }
- for (s = abfd->sections; s != (asection *)NULL;s = s->next) {
- if (s->used_by_bfd != (void *)NULL) {
- free(s->used_by_bfd);
- }
- }
- return true;
+ bfd_write("S9030000FC\n", 1,11,abfd);
}
static int
#define srec_write_armap (PROTO( boolean, (*),(bfd *, unsigned int, struct orl *, int, int))) bfd_nullvoidptr
#define srec_get_lineno (struct lineno_cache_entry *(*)())bfd_nullvoidptr
+#define srec_close_and_cleanup bfd_generic_close_and_cleanup
+
bfd_target srec_vec =
{
_bfd_generic_mkarchive,
bfd_false,
},
-JUMP_TABLE(srec)
+ { /* bfd_write_contents */
+ bfd_false,
+ srec_write_object_contents,
+ _bfd_write_archive_contents,
+ bfd_false,
+ },
+ JUMP_TABLE(srec)
};
extern bfd_target ecoff_little_vec;
extern bfd_target ecoff_big_vec;
-extern bfd_target aout_little_vec;
-extern bfd_target aout_big_vec;
+extern bfd_target sunos_big_vec;
extern bfd_target srec_vec;
extern bfd_target b_out_vec_little_host;
extern bfd_target b_out_vec_big_host;
#define ICOFF_BIG_VEC icoff_big_vec
#define B_OUT_VEC_LITTLE_HOST b_out_vec_little_host
#define B_OUT_VEC_BIG_HOST b_out_vec_big_host
-#define AOUT_VEC_LITTLE_HOST aout_little_vec
-#define AOUT_VEC_BIG_HOST aout_big_vec
+#define SUNOS_VEC_BIG_HOST sunos_big_vec
#define OASYS_VEC oasys_vec
#define IEEE_VEC ieee_vec
#define M88K_BCS_VEC m88k_bcs_vec
&OASYS_VEC,
#endif /* OASYS_VEC */
-#ifdef AOUT_VEC_LITTLE_HOST
- &AOUT_VEC_LITTLE_HOST,
-#endif /* AOUT_LITTLE_VEC */
-
-#ifdef AOUT_VEC_BIG_HOST
- &AOUT_VEC_BIG_HOST,
-#endif /* AOUT_BIG_VEC */
+#ifdef SUNOS_VEC_BIG_HOST
+ &SUNOS_VEC_BIG_HOST,
+#endif /* SUNOS_BIG_VEC */
#ifdef M88K_BCS_VEC
&M88K_BCS_VEC,