diff options
author | Alan Modra <amodra@gmail.com> | 2004-03-15 12:23:11 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2004-03-15 12:23:11 +0000 |
commit | edeb6e24a923834b3aecdcebe44e0e3467002f48 (patch) | |
tree | 571fe109696dd5a02a50aaa36eb202db5335186e | |
parent | a506b1e62a0cc1e3768fff6f223635a0f2de8eea (diff) | |
download | gdb-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.
-rw-r--r-- | bfd/ChangeLog | 45 | ||||
-rw-r--r-- | bfd/aix386-core.c | 8 | ||||
-rw-r--r-- | bfd/archive.c | 2 | ||||
-rw-r--r-- | bfd/bfd-in.h | 40 | ||||
-rw-r--r-- | bfd/bfd-in2.h | 142 | ||||
-rw-r--r-- | bfd/coff-tic54x.c | 31 | ||||
-rw-r--r-- | bfd/hppabsd-core.c | 21 | ||||
-rw-r--r-- | bfd/hpux-core.c | 21 | ||||
-rw-r--r-- | bfd/irix-core.c | 21 | ||||
-rw-r--r-- | bfd/libaout.h | 54 | ||||
-rw-r--r-- | bfd/libbfd.c | 186 | ||||
-rw-r--r-- | bfd/mach-o.c | 2 | ||||
-rw-r--r-- | bfd/netbsd-core.c | 33 | ||||
-rw-r--r-- | bfd/osf-core.c | 21 | ||||
-rw-r--r-- | bfd/pdp11.c | 49 | ||||
-rw-r--r-- | bfd/ptrace-core.c | 21 | ||||
-rw-r--r-- | bfd/sco5-core.c | 22 | ||||
-rw-r--r-- | bfd/targets.c | 38 | ||||
-rw-r--r-- | bfd/trad-core.c | 21 |
19 files changed, 375 insertions, 403 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 4085964..57fee91 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,48 @@ +2004-03-15 Alan Modra <amodra@bigpond.net.au> + + * 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. + 2004-03-15 Matt Thomas <matt@3am-software.com> * config.bfd: Add x86-64 vector to NetBSD/i386 if 64bit BFD is diff --git a/bfd/aix386-core.c b/bfd/aix386-core.c index 7725b34..51a9b99 100644 --- a/bfd/aix386-core.c +++ b/bfd/aix386-core.c @@ -2,7 +2,7 @@ This was based on trad-core.c, which was written by John Gilmore of Cygnus Support. Copyright 1988, 1989, 1991, 1992, 1993, 1994, 1996, 1998, 1999, 2000, - 2001, 2002 + 2001, 2002, 2004 Free Software Foundation, Inc. Written by Minh Tran-Le <TRANLE@INTELLICORP.COM>. Converted to back end form by Ian Lance Taylor <ian@cygnus.com>. @@ -222,9 +222,9 @@ swap_abort () abort (); } -#define NO_GET ((bfd_vma (*) PARAMS ((const bfd_byte *))) swap_abort) -#define NO_GETS ((bfd_signed_vma (*) PARAMS ((const bfd_byte *))) swap_abort) -#define NO_PUT ((void (*) PARAMS ((bfd_vma, bfd_byte *))) swap_abort) +#define NO_GET ((bfd_vma (*) (const void *)) swap_abort) +#define NO_PUT ((void (*) (bfd_vma, void *)) swap_abort) +#define NO_GETS ((bfd_signed_vma (*) (const void *)) swap_abort) const bfd_target aix386_core_vec = { "aix386-core", diff --git a/bfd/archive.c b/bfd/archive.c index c4171e7..ba6e684 100644 --- a/bfd/archive.c +++ b/bfd/archive.c @@ -753,7 +753,7 @@ do_slurp_coff_armap (bfd *abfd) unsigned int parsed_size; carsym *carsyms; bfd_size_type nsymz; /* Number of symbols in armap. */ - bfd_vma (*swap) (const bfd_byte *); + bfd_vma (*swap) (const void *); char int_buf[sizeof (long)]; bfd_size_type carsym_size, ptrsize; unsigned int i; diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h index 30bc844..482e88d 100644 --- a/bfd/bfd-in.h +++ b/bfd/bfd-in.h @@ -518,29 +518,29 @@ extern bfd_boolean bfd_record_phdr /* Byte swapping routines. */ -bfd_vma bfd_getb64 (const unsigned char *); -bfd_vma bfd_getl64 (const unsigned char *); -bfd_signed_vma bfd_getb_signed_64 (const unsigned char *); -bfd_signed_vma bfd_getl_signed_64 (const unsigned char *); -bfd_vma bfd_getb32 (const unsigned char *); -bfd_vma bfd_getl32 (const unsigned char *); -bfd_signed_vma bfd_getb_signed_32 (const unsigned char *); -bfd_signed_vma bfd_getl_signed_32 (const unsigned char *); -bfd_vma bfd_getb16 (const unsigned char *); -bfd_vma bfd_getl16 (const unsigned char *); -bfd_signed_vma bfd_getb_signed_16 (const unsigned char *); -bfd_signed_vma bfd_getl_signed_16 (const unsigned char *); -void bfd_putb64 (bfd_vma, unsigned char *); -void bfd_putl64 (bfd_vma, unsigned char *); -void bfd_putb32 (bfd_vma, unsigned char *); -void bfd_putl32 (bfd_vma, unsigned char *); -void bfd_putb16 (bfd_vma, unsigned char *); -void bfd_putl16 (bfd_vma, unsigned char *); +bfd_vma bfd_getb64 (const void *); +bfd_vma bfd_getl64 (const void *); +bfd_signed_vma bfd_getb_signed_64 (const void *); +bfd_signed_vma bfd_getl_signed_64 (const void *); +bfd_vma bfd_getb32 (const void *); +bfd_vma bfd_getl32 (const void *); +bfd_signed_vma bfd_getb_signed_32 (const void *); +bfd_signed_vma bfd_getl_signed_32 (const void *); +bfd_vma bfd_getb16 (const void *); +bfd_vma bfd_getl16 (const void *); +bfd_signed_vma bfd_getb_signed_16 (const void *); +bfd_signed_vma bfd_getl_signed_16 (const void *); +void bfd_putb64 (bfd_vma, void *); +void bfd_putl64 (bfd_vma, void *); +void bfd_putb32 (bfd_vma, void *); +void bfd_putl32 (bfd_vma, void *); +void bfd_putb16 (bfd_vma, void *); +void bfd_putl16 (bfd_vma, void *); /* Byte swapping routines which take size and endiannes as arguments. */ -bfd_vma bfd_get_bits (bfd_byte *, int, bfd_boolean); -void bfd_put_bits (bfd_vma, bfd_byte *, int, bfd_boolean); +bfd_vma bfd_get_bits (const void *, int, bfd_boolean); +void bfd_put_bits (bfd_vma, void *, int, bfd_boolean); /* Externally visible ECOFF routines. */ diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index 5963bb4..4e1c050 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -525,29 +525,29 @@ extern bfd_boolean bfd_record_phdr /* Byte swapping routines. */ -bfd_vma bfd_getb64 (const unsigned char *); -bfd_vma bfd_getl64 (const unsigned char *); -bfd_signed_vma bfd_getb_signed_64 (const unsigned char *); -bfd_signed_vma bfd_getl_signed_64 (const unsigned char *); -bfd_vma bfd_getb32 (const unsigned char *); -bfd_vma bfd_getl32 (const unsigned char *); -bfd_signed_vma bfd_getb_signed_32 (const unsigned char *); -bfd_signed_vma bfd_getl_signed_32 (const unsigned char *); -bfd_vma bfd_getb16 (const unsigned char *); -bfd_vma bfd_getl16 (const unsigned char *); -bfd_signed_vma bfd_getb_signed_16 (const unsigned char *); -bfd_signed_vma bfd_getl_signed_16 (const unsigned char *); -void bfd_putb64 (bfd_vma, unsigned char *); -void bfd_putl64 (bfd_vma, unsigned char *); -void bfd_putb32 (bfd_vma, unsigned char *); -void bfd_putl32 (bfd_vma, unsigned char *); -void bfd_putb16 (bfd_vma, unsigned char *); -void bfd_putl16 (bfd_vma, unsigned char *); +bfd_vma bfd_getb64 (const void *); +bfd_vma bfd_getl64 (const void *); +bfd_signed_vma bfd_getb_signed_64 (const void *); +bfd_signed_vma bfd_getl_signed_64 (const void *); +bfd_vma bfd_getb32 (const void *); +bfd_vma bfd_getl32 (const void *); +bfd_signed_vma bfd_getb_signed_32 (const void *); +bfd_signed_vma bfd_getl_signed_32 (const void *); +bfd_vma bfd_getb16 (const void *); +bfd_vma bfd_getl16 (const void *); +bfd_signed_vma bfd_getb_signed_16 (const void *); +bfd_signed_vma bfd_getl_signed_16 (const void *); +void bfd_putb64 (bfd_vma, void *); +void bfd_putl64 (bfd_vma, void *); +void bfd_putb32 (bfd_vma, void *); +void bfd_putl32 (bfd_vma, void *); +void bfd_putb16 (bfd_vma, void *); +void bfd_putl16 (bfd_vma, void *); /* Byte swapping routines which take size and endiannes as arguments. */ -bfd_vma bfd_get_bits (bfd_byte *, int, bfd_boolean); -void bfd_put_bits (bfd_vma, bfd_byte *, int, bfd_boolean); +bfd_vma bfd_get_bits (const void *, int, bfd_boolean); +void bfd_put_bits (bfd_vma, void *, int, bfd_boolean); /* Externally visible ECOFF routines. */ @@ -873,7 +873,7 @@ bfd_boolean bfd_fill_in_gnu_debuglink_section /* Byte swapping macros for user section data. */ #define bfd_put_8(abfd, val, ptr) \ - ((void) (*((unsigned char *) (ptr)) = (unsigned char) (val))) + ((void) (*((unsigned char *) (ptr)) = (val) & 0xff)) #define bfd_put_signed_8 \ bfd_put_8 #define bfd_get_8(abfd, ptr) \ @@ -961,52 +961,24 @@ bfd_boolean bfd_fill_in_gnu_debuglink_section #define bfd_h_get_signed_64(abfd, ptr) \ BFD_SEND (abfd, bfd_h_getx_signed_64, (ptr)) -/* Refinements on the above, which should eventually go away. Save - cluttering the source with (bfd_vma) and (bfd_byte *) casts. */ - -#define H_PUT_64(abfd, val, where) \ - bfd_h_put_64 ((abfd), (bfd_vma) (val), (bfd_byte *) (where)) - -#define H_PUT_32(abfd, val, where) \ - bfd_h_put_32 ((abfd), (bfd_vma) (val), (bfd_byte *) (where)) - -#define H_PUT_16(abfd, val, where) \ - bfd_h_put_16 ((abfd), (bfd_vma) (val), (bfd_byte *) (where)) - -#define H_PUT_8 bfd_h_put_8 - -#define H_PUT_S64(abfd, val, where) \ - bfd_h_put_signed_64 ((abfd), (bfd_vma) (val), (bfd_byte *) (where)) - -#define H_PUT_S32(abfd, val, where) \ - bfd_h_put_signed_32 ((abfd), (bfd_vma) (val), (bfd_byte *) (where)) - -#define H_PUT_S16(abfd, val, where) \ - bfd_h_put_signed_16 ((abfd), (bfd_vma) (val), (bfd_byte *) (where)) - -#define H_PUT_S8 bfd_h_put_signed_8 - -#define H_GET_64(abfd, where) \ - bfd_h_get_64 ((abfd), (bfd_byte *) (where)) - -#define H_GET_32(abfd, where) \ - bfd_h_get_32 ((abfd), (bfd_byte *) (where)) - -#define H_GET_16(abfd, where) \ - bfd_h_get_16 ((abfd), (bfd_byte *) (where)) - -#define H_GET_8 bfd_h_get_8 - -#define H_GET_S64(abfd, where) \ - bfd_h_get_signed_64 ((abfd), (bfd_byte *) (where)) - -#define H_GET_S32(abfd, where) \ - bfd_h_get_signed_32 ((abfd), (bfd_byte *) (where)) - -#define H_GET_S16(abfd, where) \ - bfd_h_get_signed_16 ((abfd), (bfd_byte *) (where)) - -#define H_GET_S8 bfd_h_get_signed_8 +/* Aliases for the above, which should eventually go away. */ + +#define H_PUT_64 bfd_h_put_64 +#define H_PUT_32 bfd_h_put_32 +#define H_PUT_16 bfd_h_put_16 +#define H_PUT_8 bfd_h_put_8 +#define H_PUT_S64 bfd_h_put_signed_64 +#define H_PUT_S32 bfd_h_put_signed_32 +#define H_PUT_S16 bfd_h_put_signed_16 +#define H_PUT_S8 bfd_h_put_signed_8 +#define H_GET_64 bfd_h_get_64 +#define H_GET_32 bfd_h_get_32 +#define H_GET_16 bfd_h_get_16 +#define H_GET_8 bfd_h_get_8 +#define H_GET_S64 bfd_h_get_signed_64 +#define H_GET_S32 bfd_h_get_signed_32 +#define H_GET_S16 bfd_h_get_signed_16 +#define H_GET_S8 bfd_h_get_signed_8 /* Extracted from bfdio.c. */ @@ -4130,26 +4102,26 @@ typedef struct bfd_target /* Entries for byte swapping for data. These are different from the other entry points, since they don't take a BFD asthe first argument. Certain other handlers could do the same. */ - bfd_vma (*bfd_getx64) (const bfd_byte *); - bfd_signed_vma (*bfd_getx_signed_64) (const bfd_byte *); - void (*bfd_putx64) (bfd_vma, bfd_byte *); - bfd_vma (*bfd_getx32) (const bfd_byte *); - bfd_signed_vma (*bfd_getx_signed_32) (const bfd_byte *); - void (*bfd_putx32) (bfd_vma, bfd_byte *); - bfd_vma (*bfd_getx16) (const bfd_byte *); - bfd_signed_vma (*bfd_getx_signed_16) (const bfd_byte *); - void (*bfd_putx16) (bfd_vma, bfd_byte *); + bfd_vma (*bfd_getx64) (const void *); + bfd_signed_vma (*bfd_getx_signed_64) (const void *); + void (*bfd_putx64) (bfd_vma, void *); + bfd_vma (*bfd_getx32) (const void *); + bfd_signed_vma (*bfd_getx_signed_32) (const void *); + void (*bfd_putx32) (bfd_vma, void *); + bfd_vma (*bfd_getx16) (const void *); + bfd_signed_vma (*bfd_getx_signed_16) (const void *); + void (*bfd_putx16) (bfd_vma, void *); /* Byte swapping for the headers. */ - bfd_vma (*bfd_h_getx64) (const bfd_byte *); - bfd_signed_vma (*bfd_h_getx_signed_64) (const bfd_byte *); - void (*bfd_h_putx64) (bfd_vma, bfd_byte *); - bfd_vma (*bfd_h_getx32) (const bfd_byte *); - bfd_signed_vma (*bfd_h_getx_signed_32) (const bfd_byte *); - void (*bfd_h_putx32) (bfd_vma, bfd_byte *); - bfd_vma (*bfd_h_getx16) (const bfd_byte *); - bfd_signed_vma (*bfd_h_getx_signed_16) (const bfd_byte *); - void (*bfd_h_putx16) (bfd_vma, bfd_byte *); + bfd_vma (*bfd_h_getx64) (const void *); + bfd_signed_vma (*bfd_h_getx_signed_64) (const void *); + void (*bfd_h_putx64) (bfd_vma, void *); + bfd_vma (*bfd_h_getx32) (const void *); + bfd_signed_vma (*bfd_h_getx_signed_32) (const void *); + void (*bfd_h_putx32) (bfd_vma, void *); + bfd_vma (*bfd_h_getx16) (const void *); + bfd_signed_vma (*bfd_h_getx_signed_16) (const void *); + void (*bfd_h_putx16) (bfd_vma, void *); /* Format dependent routines: these are vectors of entry points within the target vector structure, one for each format to check. */ diff --git a/bfd/coff-tic54x.c b/bfd/coff-tic54x.c index 5d8ccc2..316768e 100644 --- a/bfd/coff-tic54x.c +++ b/bfd/coff-tic54x.c @@ -38,12 +38,6 @@ static bfd_boolean tic54x_set_section_contents PARAMS ((bfd *, sec_ptr, const PTR, file_ptr, bfd_size_type)); static reloc_howto_type *coff_tic54x_rtype_to_howto PARAMS ((bfd *, asection *, struct internal_reloc *, struct coff_link_hash_entry *, struct internal_syment *, bfd_vma *)); -static bfd_vma tic54x_getl32 - PARAMS ((const bfd_byte *)); -static void tic54x_putl32 - PARAMS ((bfd_vma, bfd_byte *)); -static bfd_signed_vma tic54x_getl_signed_32 - PARAMS ((const bfd_byte *)); static bfd_boolean tic54x_set_arch_mach PARAMS ((bfd *, enum bfd_architecture, unsigned long)); static reloc_howto_type * tic54x_coff_reloc_type_lookup @@ -61,33 +55,32 @@ static bfd_boolean ticoff_bfd_is_local_label_name Don't bother with 64-bits, as there aren't any. */ static bfd_vma -tic54x_getl32 (addr) - const bfd_byte *addr; +tic54x_getl32 (const void *p) { + const bfd_byte *addr = p; unsigned long v; v = (unsigned long) addr[2]; v |= (unsigned long) addr[3] << 8; v |= (unsigned long) addr[0] << 16; v |= (unsigned long) addr[1] << 24; - return (bfd_vma) v; + return v; } static void -tic54x_putl32 (data, addr) - bfd_vma data; - bfd_byte *addr; +tic54x_putl32 (bfd_vma data, void *p) { - addr[2] = (bfd_byte)data; - addr[3] = (bfd_byte) (data >> 8); - addr[0] = (bfd_byte) (data >> 16); - addr[1] = (bfd_byte) (data >> 24); + bfd_byte *addr = p; + addr[2] = data & 0xff; + addr[3] = (data >> 8) & 0xff; + addr[0] = (data >> 16) & 0xff; + addr[1] = (data >> 24) & 0xff; } -bfd_signed_vma -tic54x_getl_signed_32 (addr) - register const bfd_byte *addr; +static bfd_signed_vma +tic54x_getl_signed_32 (const void *p) { + const bfd_byte *addr = p; unsigned long v; v = (unsigned long) addr[2]; diff --git a/bfd/hppabsd-core.c b/bfd/hppabsd-core.c index 4d17ba5..9d5e597 100644 --- a/bfd/hppabsd-core.c +++ b/bfd/hppabsd-core.c @@ -1,5 +1,5 @@ /* BFD back-end for HPPA BSD core files. - Copyright 1993, 1994, 1995, 1998, 1999, 2001, 2002 + Copyright 1993, 1994, 1995, 1998, 1999, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -236,10 +236,9 @@ swap_abort () abort (); } -#define NO_GET ((bfd_vma (*) PARAMS (( const bfd_byte *))) swap_abort ) -#define NO_PUT ((void (*) PARAMS ((bfd_vma, bfd_byte *))) swap_abort ) -#define NO_SIGNED_GET \ - ((bfd_signed_vma (*) PARAMS ((const bfd_byte *))) swap_abort ) +#define NO_GET ((bfd_vma (*) (const void *)) swap_abort) +#define NO_PUT ((void (*) (bfd_vma, void *)) swap_abort) +#define NO_GETS ((bfd_signed_vma (*) (const void *)) swap_abort) const bfd_target hppabsd_core_vec = { @@ -254,12 +253,12 @@ const bfd_target hppabsd_core_vec = 0, /* symbol prefix */ ' ', /* ar_pad_char */ 16, /* ar_max_namelen */ - NO_GET, NO_SIGNED_GET, NO_PUT, /* 64 bit data */ - NO_GET, NO_SIGNED_GET, NO_PUT, /* 32 bit data */ - NO_GET, NO_SIGNED_GET, NO_PUT, /* 16 bit data */ - NO_GET, NO_SIGNED_GET, NO_PUT, /* 64 bit hdrs */ - NO_GET, NO_SIGNED_GET, NO_PUT, /* 32 bit hdrs */ - NO_GET, NO_SIGNED_GET, NO_PUT, /* 16 bit hdrs */ + NO_GET, NO_GETS, NO_PUT, /* 64 bit data */ + NO_GET, NO_GETS, NO_PUT, /* 32 bit data */ + NO_GET, NO_GETS, NO_PUT, /* 16 bit data */ + NO_GET, NO_GETS, NO_PUT, /* 64 bit hdrs */ + NO_GET, NO_GETS, NO_PUT, /* 32 bit hdrs */ + NO_GET, NO_GETS, NO_PUT, /* 16 bit hdrs */ { /* bfd_check_format */ _bfd_dummy_target, /* unknown format */ diff --git a/bfd/hpux-core.c b/bfd/hpux-core.c index 04d2911..c6f6024 100644 --- a/bfd/hpux-core.c +++ b/bfd/hpux-core.c @@ -1,5 +1,5 @@ /* BFD back-end for HP/UX core files. - Copyright 1993, 1994, 1996, 1998, 1999, 2001, 2002 + Copyright 1993, 1994, 1996, 1998, 1999, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. Written by Stu Grossman, Cygnus Support. Converted to back-end form by Ian Lance Taylor, Cygnus SUpport @@ -348,10 +348,9 @@ swap_abort () { abort(); /* This way doesn't require any declaration for ANSI to fuck up */ } -#define NO_GET ((bfd_vma (*) PARAMS (( const bfd_byte *))) swap_abort ) -#define NO_PUT ((void (*) PARAMS ((bfd_vma, bfd_byte *))) swap_abort ) -#define NO_SIGNED_GET \ - ((bfd_signed_vma (*) PARAMS ((const bfd_byte *))) swap_abort ) +#define NO_GET ((bfd_vma (*) (const void *)) swap_abort) +#define NO_PUT ((void (*) (bfd_vma, void *)) swap_abort) +#define NO_GETS ((bfd_signed_vma (*) (const void *)) swap_abort) const bfd_target hpux_core_vec = { @@ -366,12 +365,12 @@ const bfd_target hpux_core_vec = 0, /* symbol prefix */ ' ', /* ar_pad_char */ 16, /* ar_max_namelen */ - NO_GET, NO_SIGNED_GET, NO_PUT, /* 64 bit data */ - NO_GET, NO_SIGNED_GET, NO_PUT, /* 32 bit data */ - NO_GET, NO_SIGNED_GET, NO_PUT, /* 16 bit data */ - NO_GET, NO_SIGNED_GET, NO_PUT, /* 64 bit hdrs */ - NO_GET, NO_SIGNED_GET, NO_PUT, /* 32 bit hdrs */ - NO_GET, NO_SIGNED_GET, NO_PUT, /* 16 bit hdrs */ + NO_GET, NO_GETS, NO_PUT, /* 64 bit data */ + NO_GET, NO_GETS, NO_PUT, /* 32 bit data */ + NO_GET, NO_GETS, NO_PUT, /* 16 bit data */ + NO_GET, NO_GETS, NO_PUT, /* 64 bit hdrs */ + NO_GET, NO_GETS, NO_PUT, /* 32 bit hdrs */ + NO_GET, NO_GETS, NO_PUT, /* 16 bit hdrs */ { /* bfd_check_format */ _bfd_dummy_target, /* unknown format */ diff --git a/bfd/irix-core.c b/bfd/irix-core.c index 1dd35fe..3962d08 100644 --- a/bfd/irix-core.c +++ b/bfd/irix-core.c @@ -1,5 +1,5 @@ /* BFD back-end for Irix core files. - Copyright 1993, 1994, 1996, 1999, 2001, 2002 + Copyright 1993, 1994, 1996, 1999, 2001, 2002, 2004 Free Software Foundation, Inc. Written by Stu Grossman, Cygnus Support. Converted to back-end form by Ian Lance Taylor, Cygnus Support @@ -299,10 +299,9 @@ swap_abort() { abort(); /* This way doesn't require any declaration for ANSI to fuck up */ } -#define NO_GET ((bfd_vma (*) PARAMS (( const bfd_byte *))) swap_abort ) -#define NO_PUT ((void (*) PARAMS ((bfd_vma, bfd_byte *))) swap_abort ) -#define NO_SIGNED_GET \ - ((bfd_signed_vma (*) PARAMS ((const bfd_byte *))) swap_abort ) +#define NO_GET ((bfd_vma (*) (const void *)) swap_abort) +#define NO_PUT ((void (*) (bfd_vma, void *)) swap_abort) +#define NO_GETS ((bfd_signed_vma (*) (const void *)) swap_abort) const bfd_target irix_core_vec = { @@ -317,12 +316,12 @@ const bfd_target irix_core_vec = 0, /* symbol prefix */ ' ', /* ar_pad_char */ 16, /* ar_max_namelen */ - NO_GET, NO_SIGNED_GET, NO_PUT, /* 64 bit data */ - NO_GET, NO_SIGNED_GET, NO_PUT, /* 32 bit data */ - NO_GET, NO_SIGNED_GET, NO_PUT, /* 16 bit data */ - NO_GET, NO_SIGNED_GET, NO_PUT, /* 64 bit hdrs */ - NO_GET, NO_SIGNED_GET, NO_PUT, /* 32 bit hdrs */ - NO_GET, NO_SIGNED_GET, NO_PUT, /* 16 bit hdrs */ + NO_GET, NO_GETS, NO_PUT, /* 64 bit data */ + NO_GET, NO_GETS, NO_PUT, /* 32 bit data */ + NO_GET, NO_GETS, NO_PUT, /* 16 bit data */ + NO_GET, NO_GETS, NO_PUT, /* 64 bit hdrs */ + NO_GET, NO_GETS, NO_PUT, /* 32 bit hdrs */ + NO_GET, NO_GETS, NO_PUT, /* 16 bit hdrs */ { /* bfd_check_format */ _bfd_dummy_target, /* unknown format */ diff --git a/bfd/libaout.h b/bfd/libaout.h index 960f9d0..87b49e5 100644 --- a/bfd/libaout.h +++ b/bfd/libaout.h @@ -29,51 +29,23 @@ #include "bfdlink.h" -/* Macros for accessing components in an aout header. Saves cluttering - the source with (bfd_vma) and (bfd_byte *) casts. */ - -#define H_PUT_64(abfd, val, where) \ - bfd_h_put_64 ((abfd), (bfd_vma) (val), (bfd_byte *) (where)) - -#define H_PUT_32(abfd, val, where) \ - bfd_h_put_32 ((abfd), (bfd_vma) (val), (bfd_byte *) (where)) - -#define H_PUT_16(abfd, val, where) \ - bfd_h_put_16 ((abfd), (bfd_vma) (val), (bfd_byte *) (where)) +/* Macros for accessing components in an aout header. */ +#define H_PUT_64 bfd_h_put_64 +#define H_PUT_32 bfd_h_put_32 +#define H_PUT_16 bfd_h_put_16 #define H_PUT_8 bfd_h_put_8 - -#define H_PUT_S64(abfd, val, where) \ - bfd_h_put_signed_64 ((abfd), (bfd_vma) (val), (bfd_byte *) (where)) - -#define H_PUT_S32(abfd, val, where) \ - bfd_h_put_signed_32 ((abfd), (bfd_vma) (val), (bfd_byte *) (where)) - -#define H_PUT_S16(abfd, val, where) \ - bfd_h_put_signed_16 ((abfd), (bfd_vma) (val), (bfd_byte *) (where)) - +#define H_PUT_S64 bfd_h_put_signed_64 +#define H_PUT_S32 bfd_h_put_signed_32 +#define H_PUT_S16 bfd_h_put_signed_16 #define H_PUT_S8 bfd_h_put_signed_8 - -#define H_GET_64(abfd, where) \ - bfd_h_get_64 ((abfd), (bfd_byte *) (where)) - -#define H_GET_32(abfd, where) \ - bfd_h_get_32 ((abfd), (bfd_byte *) (where)) - -#define H_GET_16(abfd, where) \ - bfd_h_get_16 ((abfd), (bfd_byte *) (where)) - +#define H_GET_64 bfd_h_get_64 +#define H_GET_32 bfd_h_get_32 +#define H_GET_16 bfd_h_get_16 #define H_GET_8 bfd_h_get_8 - -#define H_GET_S64(abfd, where) \ - bfd_h_get_signed_64 ((abfd), (bfd_byte *) (where)) - -#define H_GET_S32(abfd, where) \ - bfd_h_get_signed_32 ((abfd), (bfd_byte *) (where)) - -#define H_GET_S16(abfd, where) \ - bfd_h_get_signed_16 ((abfd), (bfd_byte *) (where)) - +#define H_GET_S64 bfd_h_get_signed_64 +#define H_GET_S32 bfd_h_get_signed_32 +#define H_GET_S16 bfd_h_get_signed_16 #define H_GET_S8 bfd_h_get_signed_8 /* Parameterize the a.out code based on whether it is being built diff --git a/bfd/libbfd.c b/bfd/libbfd.c index abcf44f..f17101e 100644 --- a/bfd/libbfd.c +++ b/bfd/libbfd.c @@ -1,6 +1,6 @@ /* Assorted BFD support routines, only used internally. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003 + 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. Written by Cygnus Support. @@ -266,7 +266,7 @@ DESCRIPTION .{* Byte swapping macros for user section data. *} . .#define bfd_put_8(abfd, val, ptr) \ -. ((void) (*((unsigned char *) (ptr)) = (unsigned char) (val))) +. ((void) (*((unsigned char *) (ptr)) = (val) & 0xff)) .#define bfd_put_signed_8 \ . bfd_put_8 .#define bfd_get_8(abfd, ptr) \ @@ -367,52 +367,24 @@ DESCRIPTION .#define bfd_h_get_signed_64(abfd, ptr) \ . BFD_SEND (abfd, bfd_h_getx_signed_64, (ptr)) . -.{* Refinements on the above, which should eventually go away. Save -. cluttering the source with (bfd_vma) and (bfd_byte *) casts. *} +.{* Aliases for the above, which should eventually go away. *} . -.#define H_PUT_64(abfd, val, where) \ -. bfd_h_put_64 ((abfd), (bfd_vma) (val), (bfd_byte *) (where)) -. -.#define H_PUT_32(abfd, val, where) \ -. bfd_h_put_32 ((abfd), (bfd_vma) (val), (bfd_byte *) (where)) -. -.#define H_PUT_16(abfd, val, where) \ -. bfd_h_put_16 ((abfd), (bfd_vma) (val), (bfd_byte *) (where)) -. -.#define H_PUT_8 bfd_h_put_8 -. -.#define H_PUT_S64(abfd, val, where) \ -. bfd_h_put_signed_64 ((abfd), (bfd_vma) (val), (bfd_byte *) (where)) -. -.#define H_PUT_S32(abfd, val, where) \ -. bfd_h_put_signed_32 ((abfd), (bfd_vma) (val), (bfd_byte *) (where)) -. -.#define H_PUT_S16(abfd, val, where) \ -. bfd_h_put_signed_16 ((abfd), (bfd_vma) (val), (bfd_byte *) (where)) -. -.#define H_PUT_S8 bfd_h_put_signed_8 -. -.#define H_GET_64(abfd, where) \ -. bfd_h_get_64 ((abfd), (bfd_byte *) (where)) -. -.#define H_GET_32(abfd, where) \ -. bfd_h_get_32 ((abfd), (bfd_byte *) (where)) -. -.#define H_GET_16(abfd, where) \ -. bfd_h_get_16 ((abfd), (bfd_byte *) (where)) -. -.#define H_GET_8 bfd_h_get_8 -. -.#define H_GET_S64(abfd, where) \ -. bfd_h_get_signed_64 ((abfd), (bfd_byte *) (where)) -. -.#define H_GET_S32(abfd, where) \ -. bfd_h_get_signed_32 ((abfd), (bfd_byte *) (where)) -. -.#define H_GET_S16(abfd, where) \ -. bfd_h_get_signed_16 ((abfd), (bfd_byte *) (where)) -. -.#define H_GET_S8 bfd_h_get_signed_8 +.#define H_PUT_64 bfd_h_put_64 +.#define H_PUT_32 bfd_h_put_32 +.#define H_PUT_16 bfd_h_put_16 +.#define H_PUT_8 bfd_h_put_8 +.#define H_PUT_S64 bfd_h_put_signed_64 +.#define H_PUT_S32 bfd_h_put_signed_32 +.#define H_PUT_S16 bfd_h_put_signed_16 +.#define H_PUT_S8 bfd_h_put_signed_8 +.#define H_GET_64 bfd_h_get_64 +.#define H_GET_32 bfd_h_get_32 +.#define H_GET_16 bfd_h_get_16 +.#define H_GET_8 bfd_h_get_8 +.#define H_GET_S64 bfd_h_get_signed_64 +.#define H_GET_S32 bfd_h_get_signed_32 +.#define H_GET_S16 bfd_h_get_signed_16 +.#define H_GET_S8 bfd_h_get_signed_8 . .*/ @@ -424,46 +396,53 @@ DESCRIPTION (((bfd_signed_vma) (x) ^ EIGHT_GAZILLION) - EIGHT_GAZILLION) bfd_vma -bfd_getb16 (const bfd_byte *addr) +bfd_getb16 (const void *p) { + const bfd_byte *addr = p; return (addr[0] << 8) | addr[1]; } bfd_vma -bfd_getl16 (const bfd_byte *addr) +bfd_getl16 (const void *p) { + const bfd_byte *addr = p; return (addr[1] << 8) | addr[0]; } bfd_signed_vma -bfd_getb_signed_16 (const bfd_byte *addr) +bfd_getb_signed_16 (const void *p) { + const bfd_byte *addr = p; return COERCE16 ((addr[0] << 8) | addr[1]); } bfd_signed_vma -bfd_getl_signed_16 (const bfd_byte *addr) +bfd_getl_signed_16 (const void *p) { + const bfd_byte *addr = p; return COERCE16 ((addr[1] << 8) | addr[0]); } void -bfd_putb16 (bfd_vma data, bfd_byte *addr) +bfd_putb16 (bfd_vma data, void *p) { - addr[0] = (bfd_byte) (data >> 8); - addr[1] = (bfd_byte) data; + bfd_byte *addr = p; + addr[0] = (data >> 8) & 0xff; + addr[1] = data & 0xff; } void -bfd_putl16 (bfd_vma data, bfd_byte *addr) +bfd_putl16 (bfd_vma data, void *p) { - addr[0] = (bfd_byte) data; - addr[1] = (bfd_byte) (data >> 8); + bfd_byte *addr = p; + addr[0] = data & 0xff; + addr[1] = (data >> 8) & 0xff; } bfd_vma -bfd_getb32 (const bfd_byte *addr) +bfd_getb32 (const void *p) { + const bfd_byte *addr = p; unsigned long v; v = (unsigned long) addr[0] << 24; @@ -474,8 +453,9 @@ bfd_getb32 (const bfd_byte *addr) } bfd_vma -bfd_getl32 (const bfd_byte *addr) +bfd_getl32 (const void *p) { + const bfd_byte *addr = p; unsigned long v; v = (unsigned long) addr[0]; @@ -486,8 +466,9 @@ bfd_getl32 (const bfd_byte *addr) } bfd_signed_vma -bfd_getb_signed_32 (const bfd_byte *addr) +bfd_getb_signed_32 (const void *p) { + const bfd_byte *addr = p; unsigned long v; v = (unsigned long) addr[0] << 24; @@ -498,8 +479,9 @@ bfd_getb_signed_32 (const bfd_byte *addr) } bfd_signed_vma -bfd_getl_signed_32 (const bfd_byte *addr) +bfd_getl_signed_32 (const void *p) { + const bfd_byte *addr = p; unsigned long v; v = (unsigned long) addr[0]; @@ -510,9 +492,10 @@ bfd_getl_signed_32 (const bfd_byte *addr) } bfd_vma -bfd_getb64 (const bfd_byte *addr ATTRIBUTE_UNUSED) +bfd_getb64 (const void *p ATTRIBUTE_UNUSED) { #ifdef BFD64 + const bfd_byte *addr = p; bfd_vma v; v = addr[0]; v <<= 8; @@ -532,9 +515,10 @@ bfd_getb64 (const bfd_byte *addr ATTRIBUTE_UNUSED) } bfd_vma -bfd_getl64 (const bfd_byte *addr ATTRIBUTE_UNUSED) +bfd_getl64 (const void *p ATTRIBUTE_UNUSED) { #ifdef BFD64 + const bfd_byte *addr = p; bfd_vma v; v = addr[7]; v <<= 8; @@ -555,10 +539,10 @@ bfd_getl64 (const bfd_byte *addr ATTRIBUTE_UNUSED) } bfd_signed_vma -bfd_getb_signed_64 (addr) - register const bfd_byte *addr ATTRIBUTE_UNUSED; +bfd_getb_signed_64 (const void *p ATTRIBUTE_UNUSED) { #ifdef BFD64 + const bfd_byte *addr = p; bfd_vma v; v = addr[0]; v <<= 8; @@ -578,10 +562,10 @@ bfd_getb_signed_64 (addr) } bfd_signed_vma -bfd_getl_signed_64 (addr) - register const bfd_byte *addr ATTRIBUTE_UNUSED; +bfd_getl_signed_64 (const void *p ATTRIBUTE_UNUSED) { #ifdef BFD64 + const bfd_byte *addr = p; bfd_vma v; v = addr[7]; v <<= 8; @@ -601,60 +585,65 @@ bfd_getl_signed_64 (addr) } void -bfd_putb32 (bfd_vma data, bfd_byte *addr) +bfd_putb32 (bfd_vma data, void *p) { - addr[0] = (bfd_byte) (data >> 24); - addr[1] = (bfd_byte) (data >> 16); - addr[2] = (bfd_byte) (data >> 8); - addr[3] = (bfd_byte) data; + bfd_byte *addr = p; + addr[0] = (data >> 24) & 0xff; + addr[1] = (data >> 16) & 0xff; + addr[2] = (data >> 8) & 0xff; + addr[3] = data & 0xff; } void -bfd_putl32 (bfd_vma data, bfd_byte *addr) +bfd_putl32 (bfd_vma data, void *p) { - addr[0] = (bfd_byte) data; - addr[1] = (bfd_byte) (data >> 8); - addr[2] = (bfd_byte) (data >> 16); - addr[3] = (bfd_byte) (data >> 24); + bfd_byte *addr = p; + addr[0] = data & 0xff; + addr[1] = (data >> 8) & 0xff; + addr[2] = (data >> 16) & 0xff; + addr[3] = (data >> 24) & 0xff; } void -bfd_putb64 (bfd_vma data ATTRIBUTE_UNUSED, bfd_byte *addr ATTRIBUTE_UNUSED) +bfd_putb64 (bfd_vma data ATTRIBUTE_UNUSED, void *p ATTRIBUTE_UNUSED) { #ifdef BFD64 - addr[0] = (bfd_byte) (data >> (7*8)); - addr[1] = (bfd_byte) (data >> (6*8)); - addr[2] = (bfd_byte) (data >> (5*8)); - addr[3] = (bfd_byte) (data >> (4*8)); - addr[4] = (bfd_byte) (data >> (3*8)); - addr[5] = (bfd_byte) (data >> (2*8)); - addr[6] = (bfd_byte) (data >> (1*8)); - addr[7] = (bfd_byte) (data >> (0*8)); + bfd_byte *addr = p; + addr[0] = (data >> (7*8)) & 0xff; + addr[1] = (data >> (6*8)) & 0xff; + addr[2] = (data >> (5*8)) & 0xff; + addr[3] = (data >> (4*8)) & 0xff; + addr[4] = (data >> (3*8)) & 0xff; + addr[5] = (data >> (2*8)) & 0xff; + addr[6] = (data >> (1*8)) & 0xff; + addr[7] = (data >> (0*8)) & 0xff; #else BFD_FAIL(); #endif } void -bfd_putl64 (bfd_vma data ATTRIBUTE_UNUSED, bfd_byte *addr ATTRIBUTE_UNUSED) +bfd_putl64 (bfd_vma data ATTRIBUTE_UNUSED, void *p ATTRIBUTE_UNUSED) { #ifdef BFD64 - addr[7] = (bfd_byte) (data >> (7*8)); - addr[6] = (bfd_byte) (data >> (6*8)); - addr[5] = (bfd_byte) (data >> (5*8)); - addr[4] = (bfd_byte) (data >> (4*8)); - addr[3] = (bfd_byte) (data >> (3*8)); - addr[2] = (bfd_byte) (data >> (2*8)); - addr[1] = (bfd_byte) (data >> (1*8)); - addr[0] = (bfd_byte) (data >> (0*8)); + bfd_byte *addr = p; + addr[7] = (data >> (7*8)) & 0xff; + addr[6] = (data >> (6*8)) & 0xff; + addr[5] = (data >> (5*8)) & 0xff; + addr[4] = (data >> (4*8)) & 0xff; + addr[3] = (data >> (3*8)) & 0xff; + addr[2] = (data >> (2*8)) & 0xff; + addr[1] = (data >> (1*8)) & 0xff; + addr[0] = (data >> (0*8)) & 0xff; #else BFD_FAIL(); #endif } void -bfd_put_bits (bfd_vma data, bfd_byte *addr, int bits, bfd_boolean big_p) +bfd_put_bits (bfd_vma data, void *p, int bits, bfd_boolean big_p) { + bfd_byte *addr = p; int i; int bytes; @@ -666,14 +655,15 @@ bfd_put_bits (bfd_vma data, bfd_byte *addr, int bits, bfd_boolean big_p) { int index = big_p ? bytes - i - 1 : i; - addr[index] = (bfd_byte) data; + addr[index] = data & 0xff; data >>= 8; } } bfd_vma -bfd_get_bits (bfd_byte *addr, int bits, bfd_boolean big_p) +bfd_get_bits (const void *p, int bits, bfd_boolean big_p) { + const bfd_byte *addr = p; bfd_vma data; int i; int bytes; diff --git a/bfd/mach-o.c b/bfd/mach-o.c index 2dc8073..b5d6a72 100644 --- a/bfd/mach-o.c +++ b/bfd/mach-o.c @@ -522,7 +522,7 @@ bfd_mach_o_read_header (abfd, header) bfd_mach_o_header *header; { unsigned char buf[28]; - bfd_vma (*get32) PARAMS ((const bfd_byte *)) = NULL; + bfd_vma (*get32) (const void *) = NULL; bfd_seek (abfd, 0, SEEK_SET); diff --git a/bfd/netbsd-core.c b/bfd/netbsd-core.c index adadead..8fd621d 100644 --- a/bfd/netbsd-core.c +++ b/bfd/netbsd-core.c @@ -1,6 +1,6 @@ /* BFD back end for NetBSD style core files Copyright 1988, 1989, 1991, 1992, 1993, 1996, 1998, 1999, 2000, 2001, - 2002, 2004 + 2002, 2003, 2004 Free Software Foundation, Inc. Written by Paul Kranenburg, EUR @@ -228,10 +228,9 @@ swap_abort () abort (); } -#define NO_GET ((bfd_vma (*) PARAMS (( const bfd_byte *))) swap_abort ) -#define NO_PUT ((void (*) PARAMS ((bfd_vma, bfd_byte *))) swap_abort ) -#define NO_SIGNED_GET \ - ((bfd_signed_vma (*) PARAMS ((const bfd_byte *))) swap_abort ) +#define NO_GET ((bfd_vma (*) (const void *)) swap_abort) +#define NO_PUT ((void (*) (bfd_vma, void *)) swap_abort) +#define NO_GETS ((bfd_signed_vma (*) (const void *)) swap_abort) const bfd_target netbsd_core_vec = { @@ -246,18 +245,18 @@ const bfd_target netbsd_core_vec = 0, /* Symbol prefix. */ ' ', /* ar_pad_char. */ 16, /* ar_max_namelen. */ - NO_GET, NO_SIGNED_GET, NO_PUT, /* 64 bit data. */ - NO_GET, NO_SIGNED_GET, NO_PUT, /* 32 bit data. */ - NO_GET, NO_SIGNED_GET, NO_PUT, /* 16 bit data. */ - NO_GET, NO_SIGNED_GET, NO_PUT, /* 64 bit hdrs. */ - NO_GET, NO_SIGNED_GET, NO_PUT, /* 32 bit hdrs. */ - NO_GET, NO_SIGNED_GET, NO_PUT, /* 16 bit hdrs. */ - - { /* bfd_check_format. */ - _bfd_dummy_target, /* Unknown format. */ - _bfd_dummy_target, /* Object file. */ - _bfd_dummy_target, /* Archive. */ - netbsd_core_file_p /* A core file. */ + NO_GET, NO_GETS, NO_PUT, /* 64 bit data. */ + NO_GET, NO_GETS, NO_PUT, /* 32 bit data. */ + NO_GET, NO_GETS, NO_PUT, /* 16 bit data. */ + NO_GET, NO_GETS, NO_PUT, /* 64 bit hdrs. */ + NO_GET, NO_GETS, NO_PUT, /* 32 bit hdrs. */ + NO_GET, NO_GETS, NO_PUT, /* 16 bit hdrs. */ + + { /* bfd_check_format. */ + _bfd_dummy_target, /* Unknown format. */ + _bfd_dummy_target, /* Object file. */ + _bfd_dummy_target, /* Archive. */ + netbsd_core_file_p /* A core file. */ }, { /* bfd_set_format. */ bfd_false, bfd_false, diff --git a/bfd/osf-core.c b/bfd/osf-core.c index 9ba0d18..096a17b 100644 --- a/bfd/osf-core.c +++ b/bfd/osf-core.c @@ -1,5 +1,5 @@ /* BFD back-end for OSF/1 core files. - Copyright 1993, 1994, 1995, 1998, 1999, 2001, 2002 + Copyright 1993, 1994, 1995, 1998, 1999, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -185,10 +185,9 @@ swap_abort() { abort(); /* This way doesn't require any declaration for ANSI to fuck up */ } -#define NO_GET ((bfd_vma (*) PARAMS (( const bfd_byte *))) swap_abort ) -#define NO_PUT ((void (*) PARAMS ((bfd_vma, bfd_byte *))) swap_abort ) -#define NO_SIGNED_GET \ - ((bfd_signed_vma (*) PARAMS ((const bfd_byte *))) swap_abort ) +#define NO_GET ((bfd_vma (*) (const void *)) swap_abort) +#define NO_PUT ((void (*) (bfd_vma, void *)) swap_abort) +#define NO_GETS ((bfd_signed_vma (*) (const void *)) swap_abort) const bfd_target osf_core_vec = { @@ -203,12 +202,12 @@ const bfd_target osf_core_vec = 0, /* symbol prefix */ ' ', /* ar_pad_char */ 16, /* ar_max_namelen */ - NO_GET, NO_SIGNED_GET, NO_PUT, /* 64 bit data */ - NO_GET, NO_SIGNED_GET, NO_PUT, /* 32 bit data */ - NO_GET, NO_SIGNED_GET, NO_PUT, /* 16 bit data */ - NO_GET, NO_SIGNED_GET, NO_PUT, /* 64 bit hdrs */ - NO_GET, NO_SIGNED_GET, NO_PUT, /* 32 bit hdrs */ - NO_GET, NO_SIGNED_GET, NO_PUT, /* 16 bit hdrs */ + NO_GET, NO_GETS, NO_PUT, /* 64 bit data */ + NO_GET, NO_GETS, NO_PUT, /* 32 bit data */ + NO_GET, NO_GETS, NO_PUT, /* 16 bit data */ + NO_GET, NO_GETS, NO_PUT, /* 64 bit hdrs */ + NO_GET, NO_GETS, NO_PUT, /* 32 bit hdrs */ + NO_GET, NO_GETS, NO_PUT, /* 16 bit hdrs */ { /* bfd_check_format */ _bfd_dummy_target, /* unknown format */ 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; } diff --git a/bfd/ptrace-core.c b/bfd/ptrace-core.c index 4f441ce..81dd0eb 100644 --- a/bfd/ptrace-core.c +++ b/bfd/ptrace-core.c @@ -1,5 +1,5 @@ /* BFD backend for core files which use the ptrace_user structure - Copyright 1993, 1994, 1995, 1996, 1998, 1999, 2001, 2002 + Copyright 1993, 1994, 1995, 1996, 1998, 1999, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. The structure of this file is based on trad-core.c written by John Gilmore of Cygnus Support. @@ -167,10 +167,9 @@ swap_abort () { abort (); /* This way doesn't require any declaration for ANSI to fuck up */ } -#define NO_GET ((bfd_vma (*) PARAMS (( const bfd_byte *))) swap_abort ) -#define NO_PUT ((void (*) PARAMS ((bfd_vma, bfd_byte *))) swap_abort ) -#define NO_SIGNED_GET \ - ((bfd_signed_vma (*) PARAMS ((const bfd_byte *))) swap_abort ) +#define NO_GET ((bfd_vma (*) (const void *)) swap_abort) +#define NO_PUT ((void (*) (bfd_vma, void *)) swap_abort) +#define NO_GETS ((bfd_signed_vma (*) (const void *)) swap_abort) const bfd_target ptrace_core_vec = { @@ -185,12 +184,12 @@ const bfd_target ptrace_core_vec = 0, /* symbol prefix */ ' ', /* ar_pad_char */ 16, /* ar_max_namelen */ - NO_GET, NO_SIGNED_GET, NO_PUT, /* 64 bit data */ - NO_GET, NO_SIGNED_GET, NO_PUT, /* 32 bit data */ - NO_GET, NO_SIGNED_GET, NO_PUT, /* 16 bit data */ - NO_GET, NO_SIGNED_GET, NO_PUT, /* 64 bit hdrs */ - NO_GET, NO_SIGNED_GET, NO_PUT, /* 32 bit hdrs */ - NO_GET, NO_SIGNED_GET, NO_PUT, /* 16 bit hdrs */ + NO_GET, NO_GETS, NO_PUT, /* 64 bit data */ + NO_GET, NO_GETS, NO_PUT, /* 32 bit data */ + NO_GET, NO_GETS, NO_PUT, /* 16 bit data */ + NO_GET, NO_GETS, NO_PUT, /* 64 bit hdrs */ + NO_GET, NO_GETS, NO_PUT, /* 32 bit hdrs */ + NO_GET, NO_GETS, NO_PUT, /* 16 bit hdrs */ { /* bfd_check_format */ _bfd_dummy_target, /* unknown format */ diff --git a/bfd/sco5-core.c b/bfd/sco5-core.c index 311de70..d9cb532 100644 --- a/bfd/sco5-core.c +++ b/bfd/sco5-core.c @@ -1,5 +1,6 @@ /* BFD back end for SCO5 core files (U-area and raw sections) - Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004 + Free Software Foundation, Inc. Written by Jouke Numan <jnuman@hiscom.nl> This file is part of BFD, the Binary File Descriptor library. @@ -360,10 +361,9 @@ swap_abort () { abort (); /* This way doesn't require any declaration for ANSI to fuck up */ } -#define NO_GET ((bfd_vma (*) PARAMS (( const bfd_byte *))) swap_abort ) -#define NO_PUT ((void (*) PARAMS ((bfd_vma, bfd_byte *))) swap_abort ) -#define NO_SIGNED_GET \ - ((bfd_signed_vma (*) PARAMS ((const bfd_byte *))) swap_abort ) +#define NO_GET ((bfd_vma (*) (const void *)) swap_abort) +#define NO_PUT ((void (*) (bfd_vma, void *)) swap_abort) +#define NO_GETS ((bfd_signed_vma (*) (const void *)) swap_abort) const bfd_target sco5_core_vec = { @@ -378,12 +378,12 @@ const bfd_target sco5_core_vec = 0, /* symbol prefix */ ' ', /* ar_pad_char */ 16, /* ar_max_namelen */ - NO_GET, NO_SIGNED_GET, NO_PUT, /* 64 bit data */ - NO_GET, NO_SIGNED_GET, NO_PUT, /* 32 bit data */ - NO_GET, NO_SIGNED_GET, NO_PUT, /* 16 bit data */ - NO_GET, NO_SIGNED_GET, NO_PUT, /* 64 bit hdrs */ - NO_GET, NO_SIGNED_GET, NO_PUT, /* 32 bit hdrs */ - NO_GET, NO_SIGNED_GET, NO_PUT, /* 16 bit hdrs */ + NO_GET, NO_GETS, NO_PUT, /* 64 bit data */ + NO_GET, NO_GETS, NO_PUT, /* 32 bit data */ + NO_GET, NO_GETS, NO_PUT, /* 16 bit data */ + NO_GET, NO_GETS, NO_PUT, /* 64 bit hdrs */ + NO_GET, NO_GETS, NO_PUT, /* 32 bit hdrs */ + NO_GET, NO_GETS, NO_PUT, /* 16 bit hdrs */ { /* bfd_check_format */ _bfd_dummy_target, /* unknown format */ diff --git a/bfd/targets.c b/bfd/targets.c index de4284e..c42ae0d 100644 --- a/bfd/targets.c +++ b/bfd/targets.c @@ -1,6 +1,6 @@ /* Generic target-file-type support for the BFD library. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003 + 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. Written by Cygnus Support. @@ -203,26 +203,26 @@ DESCRIPTION . {* Entries for byte swapping for data. These are different from the . other entry points, since they don't take a BFD asthe first argument. . Certain other handlers could do the same. *} -. bfd_vma (*bfd_getx64) (const bfd_byte *); -. bfd_signed_vma (*bfd_getx_signed_64) (const bfd_byte *); -. void (*bfd_putx64) (bfd_vma, bfd_byte *); -. bfd_vma (*bfd_getx32) (const bfd_byte *); -. bfd_signed_vma (*bfd_getx_signed_32) (const bfd_byte *); -. void (*bfd_putx32) (bfd_vma, bfd_byte *); -. bfd_vma (*bfd_getx16) (const bfd_byte *); -. bfd_signed_vma (*bfd_getx_signed_16) (const bfd_byte *); -. void (*bfd_putx16) (bfd_vma, bfd_byte *); +. bfd_vma (*bfd_getx64) (const void *); +. bfd_signed_vma (*bfd_getx_signed_64) (const void *); +. void (*bfd_putx64) (bfd_vma, void *); +. bfd_vma (*bfd_getx32) (const void *); +. bfd_signed_vma (*bfd_getx_signed_32) (const void *); +. void (*bfd_putx32) (bfd_vma, void *); +. bfd_vma (*bfd_getx16) (const void *); +. bfd_signed_vma (*bfd_getx_signed_16) (const void *); +. void (*bfd_putx16) (bfd_vma, void *); . . {* Byte swapping for the headers. *} -. bfd_vma (*bfd_h_getx64) (const bfd_byte *); -. bfd_signed_vma (*bfd_h_getx_signed_64) (const bfd_byte *); -. void (*bfd_h_putx64) (bfd_vma, bfd_byte *); -. bfd_vma (*bfd_h_getx32) (const bfd_byte *); -. bfd_signed_vma (*bfd_h_getx_signed_32) (const bfd_byte *); -. void (*bfd_h_putx32) (bfd_vma, bfd_byte *); -. bfd_vma (*bfd_h_getx16) (const bfd_byte *); -. bfd_signed_vma (*bfd_h_getx_signed_16) (const bfd_byte *); -. void (*bfd_h_putx16) (bfd_vma, bfd_byte *); +. bfd_vma (*bfd_h_getx64) (const void *); +. bfd_signed_vma (*bfd_h_getx_signed_64) (const void *); +. void (*bfd_h_putx64) (bfd_vma, void *); +. bfd_vma (*bfd_h_getx32) (const void *); +. bfd_signed_vma (*bfd_h_getx_signed_32) (const void *); +. void (*bfd_h_putx32) (bfd_vma, void *); +. bfd_vma (*bfd_h_getx16) (const void *); +. bfd_signed_vma (*bfd_h_getx_signed_16) (const void *); +. void (*bfd_h_putx16) (bfd_vma, void *); . . {* Format dependent routines: these are vectors of entry points . within the target vector structure, one for each format to check. *} diff --git a/bfd/trad-core.c b/bfd/trad-core.c index 0603150..f1ea166 100644 --- a/bfd/trad-core.c +++ b/bfd/trad-core.c @@ -1,6 +1,6 @@ /* BFD back end for traditional Unix core files (U-area and raw sections) Copyright 1988, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, - 2000, 2001, 2002 + 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. Written by John Gilmore of Cygnus Support. @@ -272,10 +272,9 @@ swap_abort () { abort (); /* This way doesn't require any declaration for ANSI to fuck up */ } -#define NO_GET ((bfd_vma (*) PARAMS (( const bfd_byte *))) swap_abort ) -#define NO_PUT ((void (*) PARAMS ((bfd_vma, bfd_byte *))) swap_abort ) -#define NO_SIGNED_GET \ - ((bfd_signed_vma (*) PARAMS ((const bfd_byte *))) swap_abort ) +#define NO_GET ((bfd_vma (*) (const void *)) swap_abort) +#define NO_PUT ((void (*) (bfd_vma, void *)) swap_abort) +#define NO_GETS ((bfd_signed_vma (*) (const void *)) swap_abort) const bfd_target trad_core_vec = { @@ -290,12 +289,12 @@ const bfd_target trad_core_vec = 0, /* symbol prefix */ ' ', /* ar_pad_char */ 16, /* ar_max_namelen */ - NO_GET, NO_SIGNED_GET, NO_PUT, /* 64 bit data */ - NO_GET, NO_SIGNED_GET, NO_PUT, /* 32 bit data */ - NO_GET, NO_SIGNED_GET, NO_PUT, /* 16 bit data */ - NO_GET, NO_SIGNED_GET, NO_PUT, /* 64 bit hdrs */ - NO_GET, NO_SIGNED_GET, NO_PUT, /* 32 bit hdrs */ - NO_GET, NO_SIGNED_GET, NO_PUT, /* 16 bit hdrs */ + NO_GET, NO_GETS, NO_PUT, /* 64 bit data */ + NO_GET, NO_GETS, NO_PUT, /* 32 bit data */ + NO_GET, NO_GETS, NO_PUT, /* 16 bit data */ + NO_GET, NO_GETS, NO_PUT, /* 64 bit hdrs */ + NO_GET, NO_GETS, NO_PUT, /* 32 bit hdrs */ + NO_GET, NO_GETS, NO_PUT, /* 16 bit hdrs */ { /* bfd_check_format */ _bfd_dummy_target, /* unknown format */ |