libbfd
======

Description

This file contains various routines which are used within BFD. They are not intended for export, but are documented here for completeness.

bfd_xmalloc
...........

Synopsis

     PTR  bfd_xmalloc( bfd_size_type size);

Description

Like malloc, but exit if no more memory.

bfd_write_bigendian_4byte_int
.............................

Synopsis

     void bfd_write_bigendian_4byte_int(bfd *abfd,  int i);

Description

Writes a 4 byte integer to the outputing bfd, in big endian mode regardless of what else is going on.  This is usefull in archives.

bfd_put_size
............

bfd_get_size
............

Description

These macros as used for reading and writing raw data in sections; each access (except for bytes) is vectored through the target format of the BFD and mangled accordingly. The mangling performs any necessary endian translations and removes alignment restrictions.

     #define bfd_put_8(abfd, val, ptr) \
                     (*((char *)ptr) = (char)val)
     #define bfd_get_8(abfd, ptr) \
                     (*((char *)ptr))
     #define bfd_put_16(abfd, val, ptr) \
                     BFD_SEND(abfd, bfd_putx16, (val,ptr))
     #define bfd_get_16(abfd, ptr) \
                     BFD_SEND(abfd, bfd_getx16, (ptr))
     #define bfd_put_32(abfd, val, ptr) \
                     BFD_SEND(abfd, bfd_putx32, (val,ptr))
     #define bfd_get_32(abfd, ptr) \
                     BFD_SEND(abfd, bfd_getx32, (ptr))
     #define bfd_put_64(abfd, val, ptr) \
                     BFD_SEND(abfd, bfd_putx64, (val, ptr))
     #define bfd_get_64(abfd, ptr) \
                     BFD_SEND(abfd, bfd_getx64, (ptr))

bfd_h_put_size
..............

bfd_h_get_size
..............

Description

These macros have the same function as their bfd_get_x bretherin, except that they are used for removing information for the header records of object files. Believe it or not, some object files keep their header records in big endian order, and their data in little endan order.

     #define bfd_h_put_8(abfd, val, ptr) \
                     (*((char *)ptr) = (char)val)
     #define bfd_h_get_8(abfd, ptr) \
                     (*((char *)ptr))
     #define bfd_h_put_16(abfd, val, ptr) \
                     BFD_SEND(abfd, bfd_h_putx16,(val,ptr))
     #define bfd_h_get_16(abfd, ptr) \
                     BFD_SEND(abfd, bfd_h_getx16,(ptr))
     #define bfd_h_put_32(abfd, val, ptr) \
                     BFD_SEND(abfd, bfd_h_putx32,(val,ptr))
     #define bfd_h_get_32(abfd, ptr) \
                     BFD_SEND(abfd, bfd_h_getx32,(ptr))
     #define bfd_h_put_64(abfd, val, ptr) \
                     BFD_SEND(abfd, bfd_h_putx64,(val, ptr))
     #define bfd_h_get_64(abfd, ptr) \
                     BFD_SEND(abfd, bfd_h_getx64,(ptr))

bfd_log2
........

Description

Return the log base 2 of the value supplied, rounded up. eg an arg of 1025 would return 11. Synopsis

     bfd_vma bfd_log2(bfd_vma x);