Lines Matching refs:elf
137 } elf; variable
164 elf.path, ## __VA_ARGS__); \
172 elf.path, strerror(errno)); \
198 #define elf_ptr(type, off) ((type *)(elf.begin + (off)))
202 for (var = elf.sh_table; var < elf.sh_table + elf16toh(elf.ehdr->e_shnum); ++var)
218 return elf.sh_string + elf32toh(shdr->sh_name); in section_name()
238 return &elf.sh_table[idx]; in section_by_idx()
251 elf.path = path; in init_elf()
266 elf.begin = mmap(0, stat.st_size, PROT_READ, MAP_PRIVATE, fd, 0); in init_elf()
267 if (elf.begin == MAP_FAILED) { in init_elf()
276 assert_ge(stat.st_size, sizeof(*elf.ehdr), "%lu"); in init_elf()
277 elf.ehdr = elf_ptr(Elf64_Ehdr, 0); in init_elf()
280 assert_eq(elf.ehdr->e_ident[EI_MAG0], ELFMAG0, "0x%x"); in init_elf()
281 assert_eq(elf.ehdr->e_ident[EI_MAG1], ELFMAG1, "0x%x"); in init_elf()
282 assert_eq(elf.ehdr->e_ident[EI_MAG2], ELFMAG2, "0x%x"); in init_elf()
283 assert_eq(elf.ehdr->e_ident[EI_MAG3], ELFMAG3, "0x%x"); in init_elf()
286 assert_eq(elf.ehdr->e_ident[EI_CLASS], ELFCLASS64, "%u"); in init_elf()
287 assert_eq(elf.ehdr->e_ident[EI_DATA], ELFENDIAN, "%u"); in init_elf()
288 assert_eq(elf16toh(elf.ehdr->e_type), ET_REL, "%u"); in init_elf()
289 assert_eq(elf16toh(elf.ehdr->e_machine), EM_AARCH64, "%u"); in init_elf()
292 elf.sh_table = section_by_off(elf64toh(elf.ehdr->e_shoff)); in init_elf()
293 elf.sh_string = section_begin(section_by_idx(elf16toh(elf.ehdr->e_shstrndx))); in init_elf()
362 Elf64_Shdr *sh_orig = &elf.sh_table[elf32toh(sh_rela->sh_info)]; in emit_rela_section()