• Home
  • Raw
  • Download

Lines Matching full:elf

30 #include ELFUTILS_HEADER(elf)
38 add_section_data (Elf *elf, char *buf, size_t len) in add_section_data() argument
42 Elf_Scn *scn = elf_getscn (elf, 1); in add_section_data()
63 if (elf_update (elf, ELF_C_NULL) < 0) in add_section_data()
71 static Elf *
74 Elf *elf = elf_begin (fd, use_mmap ? ELF_C_WRITE_MMAP : ELF_C_WRITE, NULL); in create_elf() local
75 if (elf == NULL) in create_elf()
77 printf ("cannot create ELF descriptor: %s\n", elf_errmsg (-1)); in create_elf()
81 // Create an ELF header. in create_elf()
82 if (gelf_newehdr (elf, class) == 0) in create_elf()
84 printf ("cannot create ELF header: %s\n", elf_errmsg (-1)); in create_elf()
89 GElf_Ehdr *ehdr = gelf_getehdr (elf, &ehdr_mem); in create_elf()
92 printf ("cannot get ELF header: %s\n", elf_errmsg (-1)); in create_elf()
103 // Update the ELF header. in create_elf()
104 if (gelf_update_ehdr (elf, ehdr) == 0) in create_elf()
106 printf ("cannot update ELF header: %s\n", elf_errmsg (-1)); in create_elf()
111 Elf_Scn *scn = elf_newscn (elf); in create_elf()
143 add_section_data (elf, DATA, DATA_LEN); in create_elf()
146 if (elf_update (elf, ELF_C_WRITE) < 0) in create_elf()
152 return elf; in create_elf()
155 static Elf *
158 printf ("Reading ELF file\n"); in read_elf()
159 Elf *elf = elf_begin (fd, use_mmap ? ELF_C_RDWR_MMAP : ELF_C_RDWR, NULL); in read_elf() local
160 if (elf == NULL) in read_elf()
162 printf ("cannot create ELF descriptor read-again: %s\n", elf_errmsg (-1)); in read_elf()
166 return elf; in read_elf()
170 check_section_size (Elf *elf, size_t size) in check_section_size() argument
172 Elf_Scn *scn = elf_getscn (elf, 1); in check_section_size()
198 check_section_data (Elf *elf, char *data, size_t len, size_t times) in check_section_data() argument
200 Elf_Scn *scn = elf_getscn (elf, 1); in check_section_data()
253 Elf *elf = create_elf (fd, class, use_mmap); in check_elf() local
254 check_section_size (elf, DATA_LEN); in check_elf()
255 check_section_data (elf, DATA, DATA_LEN, 1); in check_elf()
258 add_section_data (elf, DATA, DATA_LEN); in check_elf()
259 check_section_size (elf, 2 * DATA_LEN); in check_elf()
260 check_section_data (elf, DATA, DATA_LEN, 2); in check_elf()
262 if (elf_end (elf) != 0) in check_elf()
270 // Read the ELF from disk now. And add new data directly. in check_elf()
278 elf = read_elf (fd, use_mmap); in check_elf()
279 check_section_size (elf, DATA_LEN); in check_elf()
283 add_section_data (elf, DATA, DATA_LEN); in check_elf()
284 check_section_size (elf, 2 * DATA_LEN); in check_elf()
285 check_section_data (elf, DATA, DATA_LEN, 2); in check_elf()
288 add_section_data (elf, DATA, DATA_LEN); in check_elf()
289 check_section_size (elf, 3 * DATA_LEN); in check_elf()
290 check_section_data (elf, DATA, DATA_LEN, 3); in check_elf()
292 if (elf_end (elf) != 0) in check_elf()
300 // Read the ELF from disk now. And add new data after raw reading. in check_elf()
308 elf = read_elf (fd, use_mmap); in check_elf()
309 check_section_size (elf, DATA_LEN); in check_elf()
313 Elf_Scn *scn = elf_getscn (elf, 1); in check_elf()
335 add_section_data (elf, DATA, DATA_LEN); in check_elf()
336 check_section_size (elf, 2 * DATA_LEN); in check_elf()
337 check_section_data (elf, DATA, DATA_LEN, 2); in check_elf()
340 add_section_data (elf, DATA, DATA_LEN); in check_elf()
341 check_section_size (elf, 3 * DATA_LEN); in check_elf()
342 check_section_data (elf, DATA, DATA_LEN, 3); in check_elf()
344 if (elf_end (elf) != 0) in check_elf()
352 // Read the ELF from disk now. And add new data after data reading. in check_elf()
360 elf = read_elf (fd, use_mmap); in check_elf()
361 check_section_size (elf, DATA_LEN); in check_elf()
363 check_section_data (elf, DATA, DATA_LEN, 1); in check_elf()
368 add_section_data (elf, DATA, DATA_LEN); in check_elf()
369 check_section_size (elf, 2 * DATA_LEN); in check_elf()
370 check_section_data (elf, DATA, DATA_LEN, 2); in check_elf()
373 add_section_data (elf, DATA, DATA_LEN); in check_elf()
374 check_section_size (elf, 3 * DATA_LEN); in check_elf()
375 check_section_data (elf, DATA, DATA_LEN, 3); in check_elf()
377 if (elf_end (elf) != 0) in check_elf()