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
)
13 return (Elf32_Ehdr
*) elf_image
;
17 * elf_get_pht - Returns a pointer to the first entry in the PHT.
18 * @elf_image: pointer to the ELF file image in memory
20 static inline Elf32_Phdr
*elf_get_pht(void *elf_image
)
22 Elf32_Ehdr
*elf_hdr
= elf_get_header(elf_image
);
24 return (Elf32_Phdr
*) ((Elf32_Off
) elf_hdr
+ elf_hdr
->e_phoff
);
29 * elf_get_ph - Returns the element with the given index in the PTH
30 * @elf_image: pointer to the ELF file image in memory
31 * @index: the index of the PHT entry to look for
33 static inline Elf32_Phdr
*elf_get_ph(void *elf_image
, int index
)
35 Elf32_Phdr
*elf_pht
= elf_get_pht(elf_image
);
36 Elf32_Ehdr
*elf_hdr
= elf_get_header(elf_image
);
38 return (Elf32_Phdr
*) ((Elf32_Off
) elf_pht
+ index
* elf_hdr
->e_phentsize
);
42 * elf_hash - Returns the index in a SysV hash table for the symbol name.
43 * @name: the name of the symbol to look for
45 extern unsigned long elf_hash(const unsigned char *name
);
48 * elf_gnu_hash - Returns the index in a GNU hash table for the symbol name.
49 * @name: the name of the symbol to look for
51 extern unsigned long elf_gnu_hash(const unsigned char *name
);
54 * elf_malloc - Allocates memory to be used by ELF module contents.
55 * @memptr: pointer to a variable to hold the address of the allocated block.
56 * @alignment: alignment constraints of the block
57 * @size: the required size of the block
59 extern int elf_malloc(void **memptr
, size_t alignment
, size_t size
);
62 * elf_free - Releases memory previously allocated by elf_malloc.
63 * @memptr: the address of the allocated block
65 extern void elf_free(void *memptr
);
67 #endif /*ELF_UTILS_H_ */