aboutsummaryrefslogtreecommitdiff
path: root/bfd/libpei.h
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2001-09-18 09:57:26 +0000
committerAlan Modra <amodra@gmail.com>2001-09-18 09:57:26 +0000
commitdc810e3900d47ab2eea86d50231ff2e70b596847 (patch)
tree13fc3d267fb99c450380f08a0775b2dff076b8d7 /bfd/libpei.h
parent417412a27c87b0e738a21122a38d48aa35317eb8 (diff)
downloadbinutils-dc810e3900d47ab2eea86d50231ff2e70b596847.zip
binutils-dc810e3900d47ab2eea86d50231ff2e70b596847.tar.gz
binutils-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/libpei.h')
-rw-r--r--bfd/libpei.h140
1 files changed, 77 insertions, 63 deletions
diff --git a/bfd/libpei.h b/bfd/libpei.h
index 5b9cc04..6b232b4 100644
--- a/bfd/libpei.h
+++ b/bfd/libpei.h
@@ -58,153 +58,167 @@ PE/PEI rearrangement (and code added): Donn Terry
#ifndef GET_FCN_LNNOPTR
#define GET_FCN_LNNOPTR(abfd, ext) \
- bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_lnnoptr)
+ H_GET_32 (abfd, ext->x_sym.x_fcnary.x_fcn.x_lnnoptr)
#endif
#ifndef GET_FCN_ENDNDX
-#define GET_FCN_ENDNDX(abfd, ext) \
- bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_endndx)
+#define GET_FCN_ENDNDX(abfd, ext) \
+ H_GET_32 (abfd, ext->x_sym.x_fcnary.x_fcn.x_endndx)
#endif
#ifndef PUT_FCN_LNNOPTR
-#define PUT_FCN_LNNOPTR(abfd, in, ext) bfd_h_put_32(abfd, in, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_lnnoptr)
+#define PUT_FCN_LNNOPTR(abfd, in, ext) \
+ H_PUT_32(abfd, in, ext->x_sym.x_fcnary.x_fcn.x_lnnoptr)
#endif
#ifndef PUT_FCN_ENDNDX
-#define PUT_FCN_ENDNDX(abfd, in, ext) bfd_h_put_32(abfd, in, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_endndx)
+#define PUT_FCN_ENDNDX(abfd, in, ext) \
+ H_PUT_32(abfd, in, ext->x_sym.x_fcnary.x_fcn.x_endndx)
#endif
#ifndef GET_LNSZ_LNNO
-#define GET_LNSZ_LNNO(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *) ext->x_sym.x_misc.x_lnsz.x_lnno)
+#define GET_LNSZ_LNNO(abfd, ext) \
+ H_GET_16 (abfd, ext->x_sym.x_misc.x_lnsz.x_lnno)
#endif
#ifndef GET_LNSZ_SIZE
-#define GET_LNSZ_SIZE(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *) ext->x_sym.x_misc.x_lnsz.x_size)
+#define GET_LNSZ_SIZE(abfd, ext) \
+ H_GET_16 (abfd, ext->x_sym.x_misc.x_lnsz.x_size)
#endif
#ifndef PUT_LNSZ_LNNO
-#define PUT_LNSZ_LNNO(abfd, in, ext) bfd_h_put_16(abfd, in, (bfd_byte *)ext->x_sym.x_misc.x_lnsz.x_lnno)
+#define PUT_LNSZ_LNNO(abfd, in, ext) \
+ H_PUT_16(abfd, in, ext->x_sym.x_misc.x_lnsz.x_lnno)
#endif
#ifndef PUT_LNSZ_SIZE
-#define PUT_LNSZ_SIZE(abfd, in, ext) bfd_h_put_16(abfd, in, (bfd_byte*) ext->x_sym.x_misc.x_lnsz.x_size)
+#define PUT_LNSZ_SIZE(abfd, in, ext) \
+ H_PUT_16(abfd, in, ext->x_sym.x_misc.x_lnsz.x_size)
#endif
#ifndef GET_SCN_SCNLEN
-#define GET_SCN_SCNLEN(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *) ext->x_scn.x_scnlen)
+#define GET_SCN_SCNLEN(abfd, ext) \
+ H_GET_32 (abfd, ext->x_scn.x_scnlen)
#endif
#ifndef GET_SCN_NRELOC
-#define GET_SCN_NRELOC(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *)ext->x_scn.x_nreloc)
+#define GET_SCN_NRELOC(abfd, ext) \
+ H_GET_16 (abfd, ext->x_scn.x_nreloc)
#endif
#ifndef GET_SCN_NLINNO
-#define GET_SCN_NLINNO(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *)ext->x_scn.x_nlinno)
+#define GET_SCN_NLINNO(abfd, ext) \
+ H_GET_16 (abfd, ext->x_scn.x_nlinno)
#endif
#ifndef PUT_SCN_SCNLEN
-#define PUT_SCN_SCNLEN(abfd,in, ext) bfd_h_put_32(abfd, in, (bfd_byte *) ext->x_scn.x_scnlen)
+#define PUT_SCN_SCNLEN(abfd, in, ext) \
+ H_PUT_32(abfd, in, ext->x_scn.x_scnlen)
#endif
#ifndef PUT_SCN_NRELOC
-#define PUT_SCN_NRELOC(abfd,in, ext) bfd_h_put_16(abfd, in, (bfd_byte *)ext->x_scn.x_nreloc)
+#define PUT_SCN_NRELOC(abfd, in, ext) \
+ H_PUT_16(abfd, in, ext->x_scn.x_nreloc)
#endif
#ifndef PUT_SCN_NLINNO
-#define PUT_SCN_NLINNO(abfd,in, ext) bfd_h_put_16(abfd,in, (bfd_byte *) ext->x_scn.x_nlinno)
+#define PUT_SCN_NLINNO(abfd, in, ext) \
+ H_PUT_16(abfd,in, ext->x_scn.x_nlinno)
#endif
#ifndef GET_LINENO_LNNO
-#define GET_LINENO_LNNO(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *) (ext->l_lnno));
+#define GET_LINENO_LNNO(abfd, ext) \
+ H_GET_16 (abfd, ext->l_lnno);
#endif
#ifndef PUT_LINENO_LNNO
-#define PUT_LINENO_LNNO(abfd,val, ext) bfd_h_put_16(abfd,val, (bfd_byte *) (ext->l_lnno));
+#define PUT_LINENO_LNNO(abfd, val, ext) \
+ H_PUT_16(abfd,val, ext->l_lnno);
#endif
/* The f_symptr field in the filehdr is sometimes 64 bits. */
#ifndef GET_FILEHDR_SYMPTR
-#define GET_FILEHDR_SYMPTR bfd_h_get_32
+#define GET_FILEHDR_SYMPTR H_GET_32
#endif
#ifndef PUT_FILEHDR_SYMPTR
-#define PUT_FILEHDR_SYMPTR bfd_h_put_32
+#define PUT_FILEHDR_SYMPTR H_PUT_32
#endif
/* Some fields in the aouthdr are sometimes 64 bits. */
#ifndef GET_AOUTHDR_TSIZE
-#define GET_AOUTHDR_TSIZE bfd_h_get_32
+#define GET_AOUTHDR_TSIZE H_GET_32
#endif
#ifndef PUT_AOUTHDR_TSIZE
-#define PUT_AOUTHDR_TSIZE bfd_h_put_32
+#define PUT_AOUTHDR_TSIZE H_PUT_32
#endif
#ifndef GET_AOUTHDR_DSIZE
-#define GET_AOUTHDR_DSIZE bfd_h_get_32
+#define GET_AOUTHDR_DSIZE H_GET_32
#endif
#ifndef PUT_AOUTHDR_DSIZE
-#define PUT_AOUTHDR_DSIZE bfd_h_put_32
+#define PUT_AOUTHDR_DSIZE H_PUT_32
#endif
#ifndef GET_AOUTHDR_BSIZE
-#define GET_AOUTHDR_BSIZE bfd_h_get_32
+#define GET_AOUTHDR_BSIZE H_GET_32
#endif
#ifndef PUT_AOUTHDR_BSIZE
-#define PUT_AOUTHDR_BSIZE bfd_h_put_32
+#define PUT_AOUTHDR_BSIZE H_PUT_32
#endif
#ifndef GET_AOUTHDR_ENTRY
-#define GET_AOUTHDR_ENTRY bfd_h_get_32
+#define GET_AOUTHDR_ENTRY H_GET_32
#endif
#ifndef PUT_AOUTHDR_ENTRY
-#define PUT_AOUTHDR_ENTRY bfd_h_put_32
+#define PUT_AOUTHDR_ENTRY H_PUT_32
#endif
#ifndef GET_AOUTHDR_TEXT_START
-#define GET_AOUTHDR_TEXT_START bfd_h_get_32
+#define GET_AOUTHDR_TEXT_START H_GET_32
#endif
#ifndef PUT_AOUTHDR_TEXT_START
-#define PUT_AOUTHDR_TEXT_START bfd_h_put_32
+#define PUT_AOUTHDR_TEXT_START H_PUT_32
#endif
#ifndef GET_AOUTHDR_DATA_START
-#define GET_AOUTHDR_DATA_START bfd_h_get_32
+#define GET_AOUTHDR_DATA_START H_GET_32
#endif
#ifndef PUT_AOUTHDR_DATA_START
-#define PUT_AOUTHDR_DATA_START bfd_h_put_32
+#define PUT_AOUTHDR_DATA_START H_PUT_32
#endif
/* Some fields in the scnhdr are sometimes 64 bits. */
#ifndef GET_SCNHDR_PADDR
-#define GET_SCNHDR_PADDR bfd_h_get_32
+#define GET_SCNHDR_PADDR H_GET_32
#endif
#ifndef PUT_SCNHDR_PADDR
-#define PUT_SCNHDR_PADDR bfd_h_put_32
+#define PUT_SCNHDR_PADDR H_PUT_32
#endif
#ifndef GET_SCNHDR_VADDR
-#define GET_SCNHDR_VADDR bfd_h_get_32
+#define GET_SCNHDR_VADDR H_GET_32
#endif
#ifndef PUT_SCNHDR_VADDR
-#define PUT_SCNHDR_VADDR bfd_h_put_32
+#define PUT_SCNHDR_VADDR H_PUT_32
#endif
#ifndef GET_SCNHDR_SIZE
-#define GET_SCNHDR_SIZE bfd_h_get_32
+#define GET_SCNHDR_SIZE H_GET_32
#endif
#ifndef PUT_SCNHDR_SIZE
-#define PUT_SCNHDR_SIZE bfd_h_put_32
+#define PUT_SCNHDR_SIZE H_PUT_32
#endif
#ifndef GET_SCNHDR_SCNPTR
-#define GET_SCNHDR_SCNPTR bfd_h_get_32
+#define GET_SCNHDR_SCNPTR H_GET_32
#endif
#ifndef PUT_SCNHDR_SCNPTR
-#define PUT_SCNHDR_SCNPTR bfd_h_put_32
+#define PUT_SCNHDR_SCNPTR H_PUT_32
#endif
#ifndef GET_SCNHDR_RELPTR
-#define GET_SCNHDR_RELPTR bfd_h_get_32
+#define GET_SCNHDR_RELPTR H_GET_32
#endif
#ifndef PUT_SCNHDR_RELPTR
-#define PUT_SCNHDR_RELPTR bfd_h_put_32
+#define PUT_SCNHDR_RELPTR H_PUT_32
#endif
#ifndef GET_SCNHDR_LNNOPTR
-#define GET_SCNHDR_LNNOPTR bfd_h_get_32
+#define GET_SCNHDR_LNNOPTR H_GET_32
#endif
#ifndef PUT_SCNHDR_LNNOPTR
-#define PUT_SCNHDR_LNNOPTR bfd_h_put_32
+#define PUT_SCNHDR_LNNOPTR H_PUT_32
#endif
#ifdef COFF_WITH_pep
-#define GET_OPTHDR_IMAGE_BASE bfd_h_get_64
-#define PUT_OPTHDR_IMAGE_BASE bfd_h_put_64
-#define GET_OPTHDR_SIZE_OF_STACK_RESERVE bfd_h_get_64
-#define PUT_OPTHDR_SIZE_OF_STACK_RESERVE bfd_h_put_64
-#define GET_OPTHDR_SIZE_OF_STACK_COMMIT bfd_h_get_64
-#define PUT_OPTHDR_SIZE_OF_STACK_COMMIT bfd_h_put_64
-#define GET_OPTHDR_SIZE_OF_HEAP_RESERVE bfd_h_get_64
-#define PUT_OPTHDR_SIZE_OF_HEAP_RESERVE bfd_h_put_64
-#define GET_OPTHDR_SIZE_OF_HEAP_COMMIT bfd_h_get_64
-#define PUT_OPTHDR_SIZE_OF_HEAP_COMMIT bfd_h_put_64
+#define GET_OPTHDR_IMAGE_BASE H_GET_64
+#define PUT_OPTHDR_IMAGE_BASE H_PUT_64
+#define GET_OPTHDR_SIZE_OF_STACK_RESERVE H_GET_64
+#define PUT_OPTHDR_SIZE_OF_STACK_RESERVE H_PUT_64
+#define GET_OPTHDR_SIZE_OF_STACK_COMMIT H_GET_64
+#define PUT_OPTHDR_SIZE_OF_STACK_COMMIT H_PUT_64
+#define GET_OPTHDR_SIZE_OF_HEAP_RESERVE H_GET_64
+#define PUT_OPTHDR_SIZE_OF_HEAP_RESERVE H_PUT_64
+#define GET_OPTHDR_SIZE_OF_HEAP_COMMIT H_GET_64
+#define PUT_OPTHDR_SIZE_OF_HEAP_COMMIT H_PUT_64
#define GET_PDATA_ENTRY bfd_get_64
#define _bfd_XX_bfd_copy_private_bfd_data_common _bfd_pep_bfd_copy_private_bfd_data_common
@@ -227,16 +241,16 @@ PE/PEI rearrangement (and code added): Donn Terry
#else /* !COFF_WITH_pep */
-#define GET_OPTHDR_IMAGE_BASE bfd_h_get_32
-#define PUT_OPTHDR_IMAGE_BASE bfd_h_put_32
-#define GET_OPTHDR_SIZE_OF_STACK_RESERVE bfd_h_get_32
-#define PUT_OPTHDR_SIZE_OF_STACK_RESERVE bfd_h_put_32
-#define GET_OPTHDR_SIZE_OF_STACK_COMMIT bfd_h_get_32
-#define PUT_OPTHDR_SIZE_OF_STACK_COMMIT bfd_h_put_32
-#define GET_OPTHDR_SIZE_OF_HEAP_RESERVE bfd_h_get_32
-#define PUT_OPTHDR_SIZE_OF_HEAP_RESERVE bfd_h_put_32
-#define GET_OPTHDR_SIZE_OF_HEAP_COMMIT bfd_h_get_32
-#define PUT_OPTHDR_SIZE_OF_HEAP_COMMIT bfd_h_put_32
+#define GET_OPTHDR_IMAGE_BASE H_GET_32
+#define PUT_OPTHDR_IMAGE_BASE H_PUT_32
+#define GET_OPTHDR_SIZE_OF_STACK_RESERVE H_GET_32
+#define PUT_OPTHDR_SIZE_OF_STACK_RESERVE H_PUT_32
+#define GET_OPTHDR_SIZE_OF_STACK_COMMIT H_GET_32
+#define PUT_OPTHDR_SIZE_OF_STACK_COMMIT H_PUT_32
+#define GET_OPTHDR_SIZE_OF_HEAP_RESERVE H_GET_32
+#define PUT_OPTHDR_SIZE_OF_HEAP_RESERVE H_PUT_32
+#define GET_OPTHDR_SIZE_OF_HEAP_COMMIT H_GET_32
+#define PUT_OPTHDR_SIZE_OF_HEAP_COMMIT H_PUT_32
#define GET_PDATA_ENTRY bfd_get_32
#define _bfd_XX_bfd_copy_private_bfd_data_common _bfd_pe_bfd_copy_private_bfd_data_common