8 * elf_get_header - Returns a pointer to the ELF header structure.
9 * @elf_image: pointer to the ELF file image in memory
11 static inline Elf32_Ehdr
*elf_get_header(void *elf_image
) {
12 return (Elf32_Ehdr
*)elf_image
;
16 * elf_get_pht - Returns a pointer to the first entry in the PHT.
17 * @elf_image: pointer to the ELF file image in memory
19 static inline Elf32_Phdr
*elf_get_pht(void *elf_image
) {
20 Elf32_Ehdr
*elf_hdr
= elf_get_header(elf_image
);
22 return (Elf32_Phdr
*)((Elf32_Off
)elf_hdr
+ elf_hdr
->e_phoff
);
27 * elf_get_ph - Returns the element with the given index in the PTH
28 * @elf_image: pointer to the ELF file image in memory
29 * @index: the index of the PHT entry to look for
31 static inline Elf32_Phdr
*elf_get_ph(void *elf_image
, int index
) {
32 Elf32_Phdr
*elf_pht
= elf_get_pht(elf_image
);
33 Elf32_Ehdr
*elf_hdr
= elf_get_header(elf_image
);
35 return (Elf32_Phdr
*)((Elf32_Off
)elf_pht
+ index
* elf_hdr
->e_phentsize
);
39 * elf_hash - Returns the index in a SysV hash table for the symbol name.
40 * @name: the name of the symbol to look for
42 extern unsigned long elf_hash(const unsigned char *name
);
45 * elf_gnu_hash - Returns the index in a GNU hash table for the symbol name.
46 * @name: the name of the symbol to look for
48 extern unsigned long elf_gnu_hash(const unsigned char *name
);
51 * elf_malloc - Allocates memory to be used by ELF module contents.
52 * @memptr: pointer to a variable to hold the address of the allocated block.
53 * @alignment: alignment constraints of the block
54 * @size: the required size of the block
56 extern int elf_malloc(void **memptr
, size_t alignment
, size_t size
);
59 * elf_free - Releases memory previously allocated by elf_malloc.
60 * @memptr: the address of the allocated block
62 extern void elf_free(char *memptr
);
64 #endif /*ELF_UTILS_H_*/