📄 libbfd.texi
字号:
@section Internal functions@strong{Description}@*These routines are used within BFD.They are not intended for export, but are documented here forcompleteness.@findex bfd_write_bigendian_4byte_int@subsubsection @code{bfd_write_bigendian_4byte_int}@strong{Synopsis}@examplebfd_boolean bfd_write_bigendian_4byte_int (bfd *, unsigned int);@end example@strong{Description}@*Write a 4 byte integer @var{i} to the output BFD @var{abfd}, in bigendian order regardless of what else is going on. This is useful inarchives.@findex bfd_put_size@subsubsection @code{bfd_put_size}@findex bfd_get_size@subsubsection @code{bfd_get_size}@strong{Description}@*These macros as used for reading and writing raw data insections; each access (except for bytes) is vectored throughthe target format of the BFD and mangled accordingly. Themangling performs any necessary endian translations andremoves alignment restrictions. Note that types accepted andreturned by these macros are identical so they can be swappedaround in macros---for example, @file{libaout.h} defines @code{GET_WORD}to either @code{bfd_get_32} or @code{bfd_get_64}.In the put routines, @var{val} must be a @code{bfd_vma}. If we are on asystem without prototypes, the caller is responsible for makingsure that is true, with a cast if necessary. We don't castthem in the macro definitions because that would prevent @code{lint}or @code{gcc -Wall} from detecting sins such as passing a pointer.To detect calling these with less than a @code{bfd_vma}, use@code{gcc -Wconversion} on a host with 64 bit @code{bfd_vma}'s.@example/* Byte swapping macros for user section data. */#define bfd_put_8(abfd, val, ptr) \ ((void) (*((unsigned char *) (ptr)) = (val) & 0xff))#define bfd_put_signed_8 \ bfd_put_8#define bfd_get_8(abfd, ptr) \ (*(unsigned char *) (ptr) & 0xff)#define bfd_get_signed_8(abfd, ptr) \ (((*(unsigned char *) (ptr) & 0xff) ^ 0x80) - 0x80)#define bfd_put_16(abfd, val, ptr) \ BFD_SEND (abfd, bfd_putx16, ((val),(ptr)))#define bfd_put_signed_16 \ bfd_put_16#define bfd_get_16(abfd, ptr) \ BFD_SEND (abfd, bfd_getx16, (ptr))#define bfd_get_signed_16(abfd, ptr) \ BFD_SEND (abfd, bfd_getx_signed_16, (ptr))#define bfd_put_32(abfd, val, ptr) \ BFD_SEND (abfd, bfd_putx32, ((val),(ptr)))#define bfd_put_signed_32 \ bfd_put_32#define bfd_get_32(abfd, ptr) \ BFD_SEND (abfd, bfd_getx32, (ptr))#define bfd_get_signed_32(abfd, ptr) \ BFD_SEND (abfd, bfd_getx_signed_32, (ptr))#define bfd_put_64(abfd, val, ptr) \ BFD_SEND (abfd, bfd_putx64, ((val), (ptr)))#define bfd_put_signed_64 \ bfd_put_64#define bfd_get_64(abfd, ptr) \ BFD_SEND (abfd, bfd_getx64, (ptr))#define bfd_get_signed_64(abfd, ptr) \ BFD_SEND (abfd, bfd_getx_signed_64, (ptr))#define bfd_get(bits, abfd, ptr) \ ((bits) == 8 ? (bfd_vma) bfd_get_8 (abfd, ptr) \ : (bits) == 16 ? bfd_get_16 (abfd, ptr) \ : (bits) == 32 ? bfd_get_32 (abfd, ptr) \ : (bits) == 64 ? bfd_get_64 (abfd, ptr) \ : (abort (), (bfd_vma) - 1))#define bfd_put(bits, abfd, val, ptr) \ ((bits) == 8 ? bfd_put_8 (abfd, val, ptr) \ : (bits) == 16 ? bfd_put_16 (abfd, val, ptr) \ : (bits) == 32 ? bfd_put_32 (abfd, val, ptr) \ : (bits) == 64 ? bfd_put_64 (abfd, val, ptr) \ : (abort (), (void) 0))@end example@findex bfd_h_put_size@subsubsection @code{bfd_h_put_size}@strong{Description}@*These macros have the same function as their @code{bfd_get_x}brethren, except that they are used for removing informationfor the header records of object files. Believe it or not,some object files keep their header records in big endianorder and their data in little endian order.@example/* Byte swapping macros for file header data. */#define bfd_h_put_8(abfd, val, ptr) \ bfd_put_8 (abfd, val, ptr)#define bfd_h_put_signed_8(abfd, val, ptr) \ bfd_put_8 (abfd, val, ptr)#define bfd_h_get_8(abfd, ptr) \ bfd_get_8 (abfd, ptr)#define bfd_h_get_signed_8(abfd, ptr) \ bfd_get_signed_8 (abfd, ptr)#define bfd_h_put_16(abfd, val, ptr) \ BFD_SEND (abfd, bfd_h_putx16, (val, ptr))#define bfd_h_put_signed_16 \ bfd_h_put_16#define bfd_h_get_16(abfd, ptr) \ BFD_SEND (abfd, bfd_h_getx16, (ptr))#define bfd_h_get_signed_16(abfd, ptr) \ BFD_SEND (abfd, bfd_h_getx_signed_16, (ptr))#define bfd_h_put_32(abfd, val, ptr) \ BFD_SEND (abfd, bfd_h_putx32, (val, ptr))#define bfd_h_put_signed_32 \ bfd_h_put_32#define bfd_h_get_32(abfd, ptr) \ BFD_SEND (abfd, bfd_h_getx32, (ptr))#define bfd_h_get_signed_32(abfd, ptr) \ BFD_SEND (abfd, bfd_h_getx_signed_32, (ptr))#define bfd_h_put_64(abfd, val, ptr) \ BFD_SEND (abfd, bfd_h_putx64, (val, ptr))#define bfd_h_put_signed_64 \ bfd_h_put_64#define bfd_h_get_64(abfd, ptr) \ BFD_SEND (abfd, bfd_h_getx64, (ptr))#define bfd_h_get_signed_64(abfd, ptr) \ BFD_SEND (abfd, bfd_h_getx_signed_64, (ptr))/* 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@end example@findex bfd_log2@subsubsection @code{bfd_log2}@strong{Synopsis}@exampleunsigned int bfd_log2 (bfd_vma x);@end example@strong{Description}@*Return the log base 2 of the value supplied, rounded up. E.g., an@var{x} of 1025 returns 11. A @var{x} of 0 returns 0.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -