2020-06-15 14:18:57 +00:00
|
|
|
#ifndef COSMOPOLITAN_LIBC_ELF_H_
|
|
|
|
#define COSMOPOLITAN_LIBC_ELF_H_
|
|
|
|
#include "libc/elf/struct/ehdr.h"
|
|
|
|
#include "libc/elf/struct/phdr.h"
|
|
|
|
#include "libc/elf/struct/shdr.h"
|
|
|
|
#include "libc/elf/struct/sym.h"
|
|
|
|
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
|
|
|
COSMOPOLITAN_C_START_
|
2023-06-06 10:30:37 +00:00
|
|
|
#ifdef COSMO
|
2020-06-15 14:18:57 +00:00
|
|
|
/*───────────────────────────────────────────────────────────────────────────│─╗
|
2023-06-18 07:55:09 +00:00
|
|
|
│ cosmopolitan § executable linkable format ─╬─│┼
|
2020-06-15 14:18:57 +00:00
|
|
|
╚────────────────────────────────────────────────────────────────────────────│*/
|
|
|
|
|
2020-11-25 16:19:00 +00:00
|
|
|
bool IsElfSymbolContent(const Elf64_Sym *);
|
2023-07-02 17:19:16 +00:00
|
|
|
bool IsElf64Binary(const Elf64_Ehdr *, size_t);
|
|
|
|
char *GetElfStringTable(const Elf64_Ehdr *, size_t, const char *);
|
|
|
|
Elf64_Sym *GetElfSymbols(const Elf64_Ehdr *, size_t, int, Elf64_Xword *);
|
|
|
|
Elf64_Shdr *GetElfSymbolTable(const Elf64_Ehdr *, size_t, int, Elf64_Xword *);
|
2023-06-18 07:55:09 +00:00
|
|
|
Elf64_Phdr *GetElfProgramHeaderAddress(const Elf64_Ehdr *, size_t, Elf64_Half);
|
2020-11-25 16:19:00 +00:00
|
|
|
Elf64_Shdr *GetElfSectionHeaderAddress(const Elf64_Ehdr *, size_t, Elf64_Half);
|
2023-07-02 17:19:16 +00:00
|
|
|
const char *GetElfString(const Elf64_Ehdr *, size_t, const char *, Elf64_Word);
|
2020-11-25 16:19:00 +00:00
|
|
|
void *GetElfSectionAddress(const Elf64_Ehdr *, size_t, const Elf64_Shdr *);
|
|
|
|
const char *GetElfSectionName(const Elf64_Ehdr *, size_t, Elf64_Shdr *);
|
2023-07-02 17:19:16 +00:00
|
|
|
char *GetElfSectionNameStringTable(const Elf64_Ehdr *, size_t);
|
2020-06-15 14:18:57 +00:00
|
|
|
|
2023-06-06 10:30:37 +00:00
|
|
|
#endif /* COSMO */
|
2020-06-15 14:18:57 +00:00
|
|
|
COSMOPOLITAN_C_END_
|
|
|
|
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
|
|
|
#endif /* COSMOPOLITAN_LIBC_ELF_H_ */
|