aboutsummaryrefslogtreecommitdiff
path: root/bfd/i386lynx.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2023-08-07 14:40:35 +0930
committerAlan Modra <amodra@gmail.com>2023-08-09 08:48:09 +0930
commit226f9f4fadb087875ef98a0a55d614236c6241b3 (patch)
treee6c63b104143dd86acf739d5633649582668224e /bfd/i386lynx.c
parentfeddea4b466ce4f2bb2301fd2d4bef56e8d09ccc (diff)
downloadgdb-226f9f4fadb087875ef98a0a55d614236c6241b3.zip
gdb-226f9f4fadb087875ef98a0a55d614236c6241b3.tar.gz
gdb-226f9f4fadb087875ef98a0a55d614236c6241b3.tar.bz2
Rename bfd_bread and bfd_bwrite
These were renamed from bfd_read and bfd_write back in 2001 when they lost an unnecessary parameter. Rename them back, and get rid of a few casts that are only needed without prototyped functions (K&R C).
Diffstat (limited to 'bfd/i386lynx.c')
-rw-r--r--bfd/i386lynx.c84
1 files changed, 41 insertions, 43 deletions
diff --git a/bfd/i386lynx.c b/bfd/i386lynx.c
index 1df85bd..c2eded8 100644
--- a/bfd/i386lynx.c
+++ b/bfd/i386lynx.c
@@ -34,48 +34,46 @@
#include "libbfd.h"
#ifndef WRITE_HEADERS
-#define WRITE_HEADERS(abfd, execp) \
- { \
- if (adata(abfd).magic == undecided_magic) \
- NAME(aout,adjust_sizes_and_vmas) (abfd); \
- \
- execp->a_syms = bfd_get_symcount (abfd) * EXTERNAL_NLIST_SIZE; \
- execp->a_entry = bfd_get_start_address (abfd); \
- \
- execp->a_trsize = ((obj_textsec (abfd)->reloc_count) * \
- obj_reloc_entry_size (abfd)); \
- execp->a_drsize = ((obj_datasec (abfd)->reloc_count) * \
- obj_reloc_entry_size (abfd)); \
- NAME(aout,swap_exec_header_out) (abfd, execp, &exec_bytes); \
- \
- if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0 \
- || bfd_bwrite (&exec_bytes, (bfd_size_type) EXEC_BYTES_SIZE, \
- abfd) != EXEC_BYTES_SIZE) \
- return false; \
- /* Now write out reloc info, followed by syms and strings */ \
- \
- if (bfd_get_symcount (abfd) != 0) \
- { \
- if (bfd_seek (abfd, (file_ptr) (N_SYMOFF (execp)), SEEK_SET) \
- != 0) \
- return false; \
- \
- if (! NAME(aout,write_syms) (abfd)) return false; \
- \
- if (bfd_seek (abfd, (file_ptr) (N_TRELOFF (execp)), SEEK_SET) \
- != 0) \
- return false; \
- \
- if (!NAME(lynx,squirt_out_relocs) (abfd, obj_textsec (abfd))) \
- return false; \
- if (bfd_seek (abfd, (file_ptr) (N_DRELOFF (execp)), SEEK_SET) \
- != 0) \
- return 0; \
- \
- if (!NAME(lynx,squirt_out_relocs) (abfd, obj_datasec (abfd))) \
- return false; \
- } \
- }
+#define WRITE_HEADERS(abfd, execp) \
+ { \
+ if (adata(abfd).magic == undecided_magic) \
+ NAME (aout, adjust_sizes_and_vmas) (abfd); \
+ \
+ execp->a_syms = bfd_get_symcount (abfd) * EXTERNAL_NLIST_SIZE; \
+ execp->a_entry = bfd_get_start_address (abfd); \
+ \
+ execp->a_trsize = ((obj_textsec (abfd)->reloc_count) \
+ * obj_reloc_entry_size (abfd)); \
+ execp->a_drsize = ((obj_datasec (abfd)->reloc_count) \
+ * obj_reloc_entry_size (abfd)); \
+ NAME (aout, swap_exec_header_out) (abfd, execp, &exec_bytes); \
+ \
+ if (bfd_seek (abfd, 0, SEEK_SET) != 0 \
+ || bfd_write (&exec_bytes, EXEC_BYTES_SIZE, \
+ abfd) != EXEC_BYTES_SIZE) \
+ return false; \
+ /* Now write out reloc info, followed by syms and strings. */ \
+ \
+ if (bfd_get_outsymbols (abfd) != NULL \
+ && bfd_get_symcount (abfd) != 0) \
+ { \
+ if (bfd_seek (abfd, N_SYMOFF (execp), SEEK_SET) != 0) \
+ return false; \
+ \
+ if (! NAME (aout, write_syms) (abfd)) \
+ return false; \
+ } \
+ \
+ if (bfd_seek (abfd, N_TRELOFF (execp), SEEK_SET) != 0) \
+ return false; \
+ if (!NAME (lynx, squirt_out_relocs) (abfd, obj_textsec (abfd))) \
+ return false; \
+ \
+ if (bfd_seek (abfd, N_DRELOFF (execp), SEEK_SET) != 0) \
+ return false; \
+ if (!NAME (lynx, squirt_out_relocs) (abfd, obj_datasec (abfd))) \
+ return false; \
+ }
#endif
#include "libaout.h"
@@ -494,7 +492,7 @@ NAME(lynx,squirt_out_relocs) (bfd *abfd, asection *section)
NAME(lynx,swap_std_reloc_out) (abfd, *generic, (struct reloc_std_external *) natptr);
}
- if (bfd_bwrite (native, natsize, abfd) != natsize)
+ if (bfd_write (native, natsize, abfd) != natsize)
{
bfd_release (abfd, native);
return false;