2020-06-15 07:18:57 -07: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"
|
2023-08-13 20:31:27 -07:00
|
|
|
#ifdef _COSMO_SOURCE
|
2020-06-15 07:18:57 -07:00
|
|
|
COSMOPOLITAN_C_START_
|
|
|
|
/*───────────────────────────────────────────────────────────────────────────│─╗
|
2023-06-18 00:55:09 -07:00
|
|
|
│ cosmopolitan § executable linkable format ─╬─│┼
|
2020-06-15 07:18:57 -07:00
|
|
|
╚────────────────────────────────────────────────────────────────────────────│*/
|
2023-09-01 20:49:13 -07:00
|
|
|
/* clang-format off */
|
2020-06-15 07:18:57 -07:00
|
|
|
|
2023-11-15 20:57:18 -08:00
|
|
|
bool32 IsElfSymbolContent(const Elf64_Sym *);
|
|
|
|
bool32 IsElf64Binary(const Elf64_Ehdr *, size_t);
|
2023-07-02 10:19:16 -07:00
|
|
|
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 00:55:09 -07:00
|
|
|
Elf64_Phdr *GetElfProgramHeaderAddress(const Elf64_Ehdr *, size_t, Elf64_Half);
|
2020-11-25 08:19:00 -08:00
|
|
|
Elf64_Shdr *GetElfSectionHeaderAddress(const Elf64_Ehdr *, size_t, Elf64_Half);
|
2023-09-01 20:49:13 -07:00
|
|
|
Elf64_Shdr *FindElfSectionByName(const Elf64_Ehdr *, size_t, char *, const char *);
|
|
|
|
char *GetElfString(const Elf64_Ehdr *, size_t, const char *, Elf64_Word);
|
2020-11-25 08:19:00 -08:00
|
|
|
void *GetElfSectionAddress(const Elf64_Ehdr *, size_t, const Elf64_Shdr *);
|
2023-07-23 17:36:18 -07:00
|
|
|
void *GetElfSegmentAddress(const Elf64_Ehdr *, size_t, const Elf64_Phdr *);
|
2023-09-01 20:49:13 -07:00
|
|
|
char *GetElfSectionName(const Elf64_Ehdr *, size_t, const Elf64_Shdr *);
|
2023-07-02 10:19:16 -07:00
|
|
|
char *GetElfSectionNameStringTable(const Elf64_Ehdr *, size_t);
|
2020-06-15 07:18:57 -07:00
|
|
|
|
|
|
|
COSMOPOLITAN_C_END_
|
2023-08-13 20:31:27 -07:00
|
|
|
#endif /* _COSMO_SOURCE */
|
2020-06-15 07:18:57 -07:00
|
|
|
#endif /* COSMOPOLITAN_LIBC_ELF_H_ */
|