aboutsummaryrefslogtreecommitdiff
path: root/bfd/pdp11.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2004-03-15 12:23:11 +0000
committerAlan Modra <amodra@gmail.com>2004-03-15 12:23:11 +0000
commitedeb6e24a923834b3aecdcebe44e0e3467002f48 (patch)
tree571fe109696dd5a02a50aaa36eb202db5335186e /bfd/pdp11.c
parenta506b1e62a0cc1e3768fff6f223635a0f2de8eea (diff)
downloadgdb-edeb6e24a923834b3aecdcebe44e0e3467002f48.zip
gdb-edeb6e24a923834b3aecdcebe44e0e3467002f48.tar.gz
gdb-edeb6e24a923834b3aecdcebe44e0e3467002f48.tar.bz2
* bfd-in.h (bfd_getb64, bfd_getl64): Replace bfd_byte* with void*.
(bfd_getb32, bfd_getl32, bfd_getb16, bfd_getl16): Likewise. (bfd_getb_signed_64, bfd_getl_signed_64): Likewise. (bfd_getb_signed_32, bfd_getl_signed_32): Likewise. (bfd_getb_signed_16, bfd_getl_signed_16): Likewise. (bfd_putb64, bfd_putl64, bfd_putb32, bfd_putl32): Likewise. (bfd_putb16, bfd_putl16, bfd_get_bits, bfd_put_bits): Likewise. * libbfd.c: Likewise in function definitions. (bfd_put_8): Mask with 0xff rather than casting to char. (bfd_putb16, bfd_putl16, bfd_putb32, bfd_putl32): Likewise. (bfd_putb64, bfd_putl64, bfd_put_bits): Likewise. (H_PUT_64, H_PUT_32, H_PUT_16, H_PUT_8): Remove casts, simplify. (H_PUT_S64, H_PUT_S32, H_PUT_S16, H_PUT_S8): Likewise. (H_GET_64, H_GET_32, H_GET_16, H_GET_8): Likewise. (H_GET_S64, H_GET_S32, H_GET_S16, H_GET_S8): Likewise. * libaout.h (H_PUT_64 H_PUT_32, H_PUT_16): Remove casts, simplify. (H_PUT_S64, H_PUT_S32, H_PUT_S16): Likewise. (H_GET_64, H_GET_32, H_GET_16): Likewise. (H_GET_S64, H_GET_S32, H_GET_S16): Likewise. * archive.c (do_slurp_coff_armap): Update swap prototype. * coff-tic54x.c (tic54x_getl32): Replace bfd_byte* with void*. (tic54x_getl_signed_32): Likewise. (tic54x_putl32): Likewise. Mask with 0xff rather than casting to char. * mach-o.c (bfd_mach_o_read_header): Update get32 prototype. * pdp11.c (bfd_getp32): Make static, replace bfd_byte* with void*. (bfd_getp_signed_32, bfd_putp32): Likewise. * targets.c (struct bfd_target): Use void* in place of bfd_byte* for bfd_getx64, bfd_getx_signed_64, bfd_putx64, bfd_getx32, bfd_getx_signed_32, bfd_putx32, bfd_getx16, bfd_getx_signed_16, bfd_putx16, bfd_h_getx64, bfd_h_getx_signed_64, bfd_h_putx64, bfd_h_getx32, bfd_h_getx_signed_32, bfd_h_putx32, bfd_h_getx16, bfd_h_getx_signed_16, bfd_h_putx16. * aix386-core.c (NO_GET, NO_GETS, NO_PUT): Update prototypes. * hppabsd-core.c: Similarly. Rename NO_SIGNED_GET to NO_GETS. * hpux-core.c: Likewise. * irix-core.c: Likewise. * netbsd-core.c: Likewise. * osf-core.c: Likewise. * ptrace-core.c: Likewise. * sco5-core.c: Likewise. * trad-core.c: Likewise. * bfd-in2.h: Regenerate.
Diffstat (limited to 'bfd/pdp11.c')
-rw-r--r--bfd/pdp11.c49
1 files changed, 28 insertions, 21 deletions
diff --git a/bfd/pdp11.c b/bfd/pdp11.c
index a4af824..95d2ccd 100644
--- a/bfd/pdp11.c
+++ b/bfd/pdp11.c
@@ -134,9 +134,9 @@ struct pdp11_external_nlist
static bfd_boolean MY(write_object_contents) PARAMS ((bfd *abfd));
#define MY_text_includes_header 1
-bfd_vma bfd_getp32 PARAMS ((const bfd_byte *));
-bfd_signed_vma bfd_getp_signed_32 PARAMS ((const bfd_byte *));
-void bfd_putp32 PARAMS ((bfd_vma, bfd_byte *));
+static bfd_vma bfd_getp32 (const void *);
+static bfd_signed_vma bfd_getp_signed_32 (const void *);
+static void bfd_putp32 (bfd_vma, void *);
#define MY_BFD_TARGET
@@ -5004,31 +5004,38 @@ aout_link_reloc_link_order (finfo, o, p)
}
/* end of modified aoutx.h */
-bfd_vma
-bfd_getp32 (addr)
- const bfd_byte *addr;
+static bfd_vma
+bfd_getp32 (const void *p)
{
- return (((((bfd_vma)addr[1] << 8) | addr[0]) << 8)
- | addr[3]) << 8 | addr[2];
+ const bfd_byte *addr = p;
+ unsigned long v;
+ v = (unsigned long) addr[1] << 24;
+ v |= (unsigned long) addr[0] << 16;
+ v |= (unsigned long) addr[3] << 8;
+ v |= (unsigned long) addr[2];
+ return v;
}
#define COERCE32(x) (((bfd_signed_vma) (x) ^ 0x80000000) - 0x80000000)
-bfd_signed_vma
-bfd_getp_signed_32 (addr)
- const bfd_byte *addr;
+static bfd_signed_vma
+bfd_getp_signed_32 (const void *p)
{
- return COERCE32((((((bfd_vma)addr[1] << 8) | addr[0]) << 8)
- | addr[3]) << 8 | addr[2]);
+ const bfd_byte *addr = p;
+ unsigned long v;
+ v = (unsigned long) addr[1] << 24;
+ v |= (unsigned long) addr[0] << 16;
+ v |= (unsigned long) addr[3] << 8;
+ v |= (unsigned long) addr[2];
+ return COERCE32 (v);
}
-void
-bfd_putp32 (data, addr)
- bfd_vma data;
- bfd_byte *addr;
+static void
+bfd_putp32 (bfd_vma data, void *p)
{
- addr[0] = (bfd_byte)(data >> 16);
- addr[1] = (bfd_byte)(data >> 24);
- addr[2] = (bfd_byte)data;
- addr[3] = (bfd_byte)(data >> 8);
+ bfd_byte *addr = p;
+ addr[0] = (data >> 16) & 0xff;
+ addr[1] = (data >> 24) & 0xff;
+ addr[2] = (data >> 0) & 0xff;
+ addr[3] = (data >> 8) & 0xff;
}