Lines Matching refs:ehdr
34 void InitEhdr(Ehdr* ehdr, uint32_t elf_class, uint32_t machine) { in InitEhdr() argument
35 memset(ehdr, 0, sizeof(Ehdr)); in InitEhdr()
36 memcpy(&ehdr->e_ident[0], ELFMAG, SELFMAG); in InitEhdr()
37 ehdr->e_ident[EI_DATA] = ELFDATA2LSB; in InitEhdr()
38 ehdr->e_ident[EI_VERSION] = EV_CURRENT; in InitEhdr()
39 ehdr->e_ident[EI_OSABI] = ELFOSABI_SYSV; in InitEhdr()
40 ehdr->e_ident[EI_CLASS] = elf_class; in InitEhdr()
41 ehdr->e_type = ET_DYN; in InitEhdr()
42 ehdr->e_machine = machine; in InitEhdr()
43 ehdr->e_version = EV_CURRENT; in InitEhdr()
44 ehdr->e_ehsize = sizeof(Ehdr); in InitEhdr()
48 void GenElf(Ehdr* ehdr, int fd) { in GenElf() argument
50 ehdr->e_shoff = offset; in GenElf()
51 ehdr->e_shnum = 3; in GenElf()
52 ehdr->e_shentsize = sizeof(Shdr); in GenElf()
53 ehdr->e_shstrndx = 2; in GenElf()
54 TEMP_FAILURE_RETRY(write(fd, ehdr, sizeof(Ehdr))); in GenElf()
61 offset += ehdr->e_shentsize; in GenElf()
71 offset += ehdr->e_shentsize; in GenElf()