aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bfd/coff-i960.c15
-rw-r--r--bfd/coff-m88k.c10
-rw-r--r--bfd/coff-mips.c81
-rw-r--r--bfd/ieee.c42
-rw-r--r--bfd/oasys.c52
-rw-r--r--bfd/opncls.c10
-rw-r--r--bfd/srec.c50
-rw-r--r--bfd/targets.c16
8 files changed, 114 insertions, 162 deletions
diff --git a/bfd/coff-i960.c b/bfd/coff-i960.c
index b80c80d..cb34740 100644
--- a/bfd/coff-i960.c
+++ b/bfd/coff-i960.c
@@ -165,13 +165,12 @@ bfd_target icoff_little_vec =
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 */
@@ -190,9 +189,11 @@ bfd_target icoff_big_vec =
_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)
};
-
diff --git a/bfd/coff-m88k.c b/bfd/coff-m88k.c
index 8ab3e6d..cdb79088 100644
--- a/bfd/coff-m88k.c
+++ b/bfd/coff-m88k.c
@@ -112,10 +112,8 @@ bfd_target m88k_bcs_vec =
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)
+};
diff --git a/bfd/coff-mips.c b/bfd/coff-mips.c
index d424932..8dd29a9 100644
--- a/bfd/coff-mips.c
+++ b/bfd/coff-mips.c
@@ -264,15 +264,6 @@ ecoff_set_section_linenos (abfd, section, location, offset, count)
return 0;
}
-
-/* ARGSUSED */
-boolean
-ecoff_close_and_cleanup (abfd)
- bfd *abfd;
-{
- return false;
-}
-
/* ARGSUSED */
static boolean
ecoff_slurp_symbol_table(abfd)
@@ -373,59 +364,69 @@ return (alent *)NULL;
#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)
};
diff --git a/bfd/ieee.c b/bfd/ieee.c
index 7774148..6812d4d 100644
--- a/bfd/ieee.c
+++ b/bfd/ieee.c
@@ -999,12 +999,14 @@ DEFUN(ieee_object_p,(abfd),
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);
@@ -1760,33 +1762,6 @@ DEFUN(ieee_make_empty_symbol,(abfd),
}
-
-
-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;
@@ -1869,6 +1844,7 @@ DEFUN(ieee_sizeof_headers,(abfd, x),
#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 */
@@ -1900,5 +1876,11 @@ bfd_target ieee_vec =
_bfd_generic_mkarchive,
bfd_false
},
-JUMP_TABLE(ieee)
+ {
+ bfd_false,
+ ieee_write_object_contents,
+ _bfd_write_archive_contents,
+ bfd_false,
+ },
+ JUMP_TABLE(ieee)
};
diff --git a/bfd/oasys.c b/bfd/oasys.c
index 431f510..7484d3f 100644
--- a/bfd/oasys.c
+++ b/bfd/oasys.c
@@ -396,12 +396,14 @@ DEFUN(oasys_object_p,(abfd),
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:
@@ -650,9 +652,9 @@ static boolean
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);
@@ -1042,7 +1044,7 @@ static boolean
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)
{
@@ -1085,34 +1087,6 @@ DEFUN(oasys_make_empty_symbol,(abfd),
/* 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;
@@ -1199,7 +1173,7 @@ return 0;
#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
@@ -1226,11 +1200,17 @@ bfd_target oasys_vec =
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)
};
diff --git a/bfd/opncls.c b/bfd/opncls.c
index b280a13..65687e6 100644
--- a/bfd/opncls.c
+++ b/bfd/opncls.c
@@ -257,11 +257,16 @@ boolean
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;
@@ -269,6 +274,7 @@ bfd_close (abfd)
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;
}
diff --git a/bfd/srec.c b/bfd/srec.c
index b5123ea..9ac2048 100644
--- a/bfd/srec.c
+++ b/bfd/srec.c
@@ -29,7 +29,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
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.
@@ -42,7 +42,11 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/* $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.
*
@@ -167,7 +171,7 @@ unsigned int length;
}
/*
- 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
@@ -291,7 +295,7 @@ file_ptr offset;
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);
@@ -394,33 +398,11 @@ int bytes_to_do;
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
@@ -454,6 +436,8 @@ return 0;
#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 =
{
@@ -482,5 +466,11 @@ 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)
};
diff --git a/bfd/targets.c b/bfd/targets.c
index 442352e..bbcdd51 100644
--- a/bfd/targets.c
+++ b/bfd/targets.c
@@ -28,8 +28,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
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;
@@ -54,8 +53,7 @@ extern bfd_target m68kcoff_vec;
#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
@@ -86,13 +84,9 @@ bfd_target *target_vector[] = {
&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,