40 lines
1.4 KiB
C
40 lines
1.4 KiB
C
|
|
/* Byte alignment for the ELF data types will always match the size.
|
||
|
|
* For example a structure containing an Elf32_Addr member will
|
||
|
|
* be aligned on a 4-byte boundary within the file.
|
||
|
|
* REF: https://gabi.xinuos.com/elf/01-intro.html
|
||
|
|
*/
|
||
|
|
|
||
|
|
#ifndef BFPG_ELF_INTEGERS_H
|
||
|
|
# define BFPG_ELF_INTEGERS_H
|
||
|
|
|
||
|
|
# include <stdint.h>
|
||
|
|
|
||
|
|
/* 32-Bit & 64-Bit Shared Integer Types */
|
||
|
|
# define Elf_Addr(BITS) uint##BITS##_t
|
||
|
|
# define Elf_Off(BITS) uint##BITS##_t
|
||
|
|
typedef uint16_t Elf_Half; /* Unsigned medium integer */
|
||
|
|
typedef uint32_t Elf_Word; /* Unsigned integer */
|
||
|
|
typedef int32_t Elf_Sword; /* Signed integer */
|
||
|
|
typedef uint64_t Elf_Xword; /* Unsigned long integer */
|
||
|
|
typedef int64_t Elf_Sxword; /* Signed long integer */
|
||
|
|
// typedef uint8_t unsigned char; /* Unsigned small integer */
|
||
|
|
|
||
|
|
/* 32-Bit Integer Types */
|
||
|
|
typedef Elf_Addr(32) Elf32_Addr; /* Unsigned program address */
|
||
|
|
typedef Elf_Off(32) Elf32_Off; /* Unsigned file offset */
|
||
|
|
typedef Elf_Half Elf32_Half;
|
||
|
|
typedef Elf_Word Elf32_Word;
|
||
|
|
typedef Elf_Sword Elf32_Sword;
|
||
|
|
/* 64-Bit Integer Types */
|
||
|
|
typedef Elf_Addr(64) Elf64_Addr; /* Unsigned program address */
|
||
|
|
typedef Elf_Off(64) Elf64_Off; /* Unsigned file offset */
|
||
|
|
typedef Elf_Half Elf64_Half;
|
||
|
|
typedef Elf_Word Elf64_Word;
|
||
|
|
typedef Elf_Sword Elf64_Sword;
|
||
|
|
typedef Elf_Xword Elf64_Xword;
|
||
|
|
typedef Elf_Sxword Elf64_Sxword;
|
||
|
|
# undef Elf_Addr
|
||
|
|
# undef Elf_Off
|
||
|
|
|
||
|
|
#endif /* BFPG_ELF_INTEGERS_H */
|