diff options
author | Alan Modra <amodra@gmail.com> | 2001-09-18 09:57:26 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2001-09-18 09:57:26 +0000 |
commit | dc810e3900d47ab2eea86d50231ff2e70b596847 (patch) | |
tree | 13fc3d267fb99c450380f08a0775b2dff076b8d7 /bfd/i386os9k.c | |
parent | 417412a27c87b0e738a21122a38d48aa35317eb8 (diff) | |
download | gdb-dc810e3900d47ab2eea86d50231ff2e70b596847.zip gdb-dc810e3900d47ab2eea86d50231ff2e70b596847.tar.gz gdb-dc810e3900d47ab2eea86d50231ff2e70b596847.tar.bz2 |
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
Diffstat (limited to 'bfd/i386os9k.c')
-rw-r--r-- | bfd/i386os9k.c | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/bfd/i386os9k.c b/bfd/i386os9k.c index 34dabc3..626fc77 100644 --- a/bfd/i386os9k.c +++ b/bfd/i386os9k.c @@ -44,28 +44,28 @@ os9k_swap_exec_header_in (abfd, raw_bytes, execp) unsigned int dload, dmemsize, dmemstart; /* Now fill in fields in the execp, from the bytes in the raw data. */ - execp->a_info = bfd_h_get_16 (abfd, bytes->m_sync); + execp->a_info = H_GET_16 (abfd, bytes->m_sync); execp->a_syms = 0; - execp->a_entry = bfd_h_get_32 (abfd, bytes->m_exec); + execp->a_entry = H_GET_32 (abfd, bytes->m_exec); execp->a_talign = 2; execp->a_dalign = 2; execp->a_balign = 2; - dload = bfd_h_get_32 (abfd, bytes->m_idata); + dload = H_GET_32 (abfd, bytes->m_idata); execp->a_data = dload + 8; if (bfd_seek (abfd, (file_ptr) dload, SEEK_SET) != 0 - || (bfd_read (&dmemstart, sizeof (dmemstart), 1, abfd) + || (bfd_bread (&dmemstart, (bfd_size_type) sizeof (dmemstart), abfd) != sizeof (dmemstart)) - || (bfd_read (&dmemsize, sizeof (dmemsize), 1, abfd) + || (bfd_bread (&dmemsize, (bfd_size_type) sizeof (dmemsize), abfd) != sizeof (dmemsize))) return false; execp->a_tload = 0; - execp->a_dload = bfd_h_get_32 (abfd, (unsigned char *) &dmemstart); + execp->a_dload = H_GET_32 (abfd, (unsigned char *) &dmemstart); execp->a_text = dload - execp->a_tload; - execp->a_data = bfd_h_get_32 (abfd, (unsigned char *) &dmemsize); - execp->a_bss = bfd_h_get_32 (abfd, bytes->m_data) - execp->a_data; + execp->a_data = H_GET_32 (abfd, (unsigned char *) &dmemsize); + execp->a_bss = H_GET_32 (abfd, bytes->m_data) - execp->a_data; execp->a_trsize = 0; execp->a_drsize = 0; @@ -77,10 +77,9 @@ os9k_swap_exec_header_in (abfd, raw_bytes, execp) /* Swaps the information in an internal exec header structure into the supplied buffer ready for writing to disk. */ -PROTO (void, os9k_swap_exec_header_out, - (bfd * abfd, - struct internal_exec * execp, - struct mh_com * raw_bytes)); +void os9k_swap_exec_header_out + PARAMS ((bfd *, struct internal_exec *, struct mh_com *)); + void os9k_swap_exec_header_out (abfd, execp, raw_bytes) bfd *abfd; @@ -90,16 +89,16 @@ os9k_swap_exec_header_out (abfd, execp, raw_bytes) mh_com *bytes = (mh_com *) raw_bytes; /* Now fill in fields in the raw data, from the fields in the exec struct. */ - bfd_h_put_32 (abfd, execp->a_info, bytes->e_info); - bfd_h_put_32 (abfd, execp->a_text, bytes->e_text); - bfd_h_put_32 (abfd, execp->a_data, bytes->e_data); - bfd_h_put_32 (abfd, execp->a_bss, bytes->e_bss); - bfd_h_put_32 (abfd, execp->a_syms, bytes->e_syms); - bfd_h_put_32 (abfd, execp->a_entry, bytes->e_entry); - bfd_h_put_32 (abfd, execp->a_trsize, bytes->e_trsize); - bfd_h_put_32 (abfd, execp->a_drsize, bytes->e_drsize); - bfd_h_put_32 (abfd, execp->a_tload, bytes->e_tload); - bfd_h_put_32 (abfd, execp->a_dload, bytes->e_dload); + H_PUT_32 (abfd, execp->a_info, bytes->e_info); + H_PUT_32 (abfd, execp->a_text, bytes->e_text); + H_PUT_32 (abfd, execp->a_data, bytes->e_data); + H_PUT_32 (abfd, execp->a_bss, bytes->e_bss); + H_PUT_32 (abfd, execp->a_syms, bytes->e_syms); + H_PUT_32 (abfd, execp->a_entry, bytes->e_entry); + H_PUT_32 (abfd, execp->a_trsize, bytes->e_trsize); + H_PUT_32 (abfd, execp->a_drsize, bytes->e_drsize); + H_PUT_32 (abfd, execp->a_tload, bytes->e_tload); + H_PUT_32 (abfd, execp->a_dload, bytes->e_dload); bytes->e_talign[0] = execp->a_talign; bytes->e_dalign[0] = execp->a_dalign; bytes->e_balign[0] = execp->a_balign; @@ -115,7 +114,7 @@ os9k_object_p (abfd) struct internal_exec anexec; mh_com exec_bytes; - if (bfd_read ((PTR) & exec_bytes, MHCOM_BYTES_SIZE, 1, abfd) + if (bfd_bread ((PTR) &exec_bytes, (bfd_size_type) MHCOM_BYTES_SIZE, abfd) != MHCOM_BYTES_SIZE) { if (bfd_get_error () != bfd_error_system_call) @@ -123,7 +122,7 @@ os9k_object_p (abfd) return 0; } - anexec.a_info = bfd_h_get_16 (abfd, exec_bytes.m_sync); + anexec.a_info = H_GET_16 (abfd, exec_bytes.m_sync); if (N_BADMAG (anexec)) { bfd_set_error (bfd_error_wrong_format); @@ -199,8 +198,9 @@ os9k_mkobject (abfd) bfd *abfd; { struct bout_data_struct *rawptr; + bfd_size_type amt = sizeof (struct bout_data_struct); - rawptr = (struct bout_data_struct *) bfd_zalloc (abfd, sizeof (struct bout_data_struct)); + rawptr = (struct bout_data_struct *) bfd_zalloc (abfd, amt); if (rawptr == NULL) return false; @@ -245,8 +245,8 @@ os9k_write_object_contents (abfd) bout_swap_exec_header_out (abfd, exec_hdr (abfd), &swapped_hdr); if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0 - || (bfd_write ((PTR) & swapped_hdr, 1, EXEC_BYTES_SIZE, abfd) - != EXEC_BYTES_SIZE)) + || bfd_bwrite ((PTR) & swapped_hdr, (bfd_size_type) EXEC_BYTES_SIZE, + abfd) != EXEC_BYTES_SIZE) return false; /* Now write out reloc info, followed by syms and strings. */ @@ -299,7 +299,7 @@ os9k_set_section_contents (abfd, section, location, offset, count) return false; if (count != 0) - return (bfd_write ((PTR) location, 1, count, abfd) == count) ? true : false; + return bfd_bwrite ((PTR) location, (bfd_size_type) count, abfd) == count; return true; } @@ -368,7 +368,7 @@ const bfd_target i386os9k_vec = BFD_JUMP_TABLE_WRITE (aout_32), BFD_JUMP_TABLE_LINK (os9k), BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), - + NULL, (PTR) 0, |