Lines Matching refs:sec
273 struct section *sec = &secs[i]; in read_shdrs() local
275 sec->shdr_offset = ftell(fp); in read_shdrs()
279 sec->shdr.sh_name = elf_word_to_cpu(shdr.sh_name); in read_shdrs()
280 sec->shdr.sh_type = elf_word_to_cpu(shdr.sh_type); in read_shdrs()
281 sec->shdr.sh_flags = elf_xword_to_cpu(shdr.sh_flags); in read_shdrs()
282 sec->shdr.sh_addr = elf_addr_to_cpu(shdr.sh_addr); in read_shdrs()
283 sec->shdr.sh_offset = elf_off_to_cpu(shdr.sh_offset); in read_shdrs()
284 sec->shdr.sh_size = elf_xword_to_cpu(shdr.sh_size); in read_shdrs()
285 sec->shdr.sh_link = elf_word_to_cpu(shdr.sh_link); in read_shdrs()
286 sec->shdr.sh_info = elf_word_to_cpu(shdr.sh_info); in read_shdrs()
287 sec->shdr.sh_addralign = elf_xword_to_cpu(shdr.sh_addralign); in read_shdrs()
288 sec->shdr.sh_entsize = elf_xword_to_cpu(shdr.sh_entsize); in read_shdrs()
289 if (sec->shdr.sh_link < ehdr.e_shnum) in read_shdrs()
290 sec->link = &secs[sec->shdr.sh_link]; in read_shdrs()
299 struct section *sec = &secs[i]; in read_strtabs() local
301 if (sec->shdr.sh_type != SHT_STRTAB) in read_strtabs()
304 sec->strtab = malloc(sec->shdr.sh_size); in read_strtabs()
305 if (!sec->strtab) in read_strtabs()
307 sec->shdr.sh_size); in read_strtabs()
309 if (fseek(fp, sec->shdr.sh_offset, SEEK_SET) < 0) in read_strtabs()
311 sec->shdr.sh_offset, strerror(errno)); in read_strtabs()
313 if (fread(sec->strtab, 1, sec->shdr.sh_size, fp) != in read_strtabs()
314 sec->shdr.sh_size) in read_strtabs()
324 struct section *sec = &secs[i]; in read_symtabs() local
325 if (sec->shdr.sh_type != SHT_SYMTAB) in read_symtabs()
328 sec->symtab = malloc(sec->shdr.sh_size); in read_symtabs()
329 if (!sec->symtab) in read_symtabs()
331 sec->shdr.sh_size); in read_symtabs()
333 if (fseek(fp, sec->shdr.sh_offset, SEEK_SET) < 0) in read_symtabs()
335 sec->shdr.sh_offset, strerror(errno)); in read_symtabs()
337 if (fread(sec->symtab, 1, sec->shdr.sh_size, fp) != in read_symtabs()
338 sec->shdr.sh_size) in read_symtabs()
341 for (j = 0; j < sec->shdr.sh_size/sizeof(Elf_Sym); j++) { in read_symtabs()
342 Elf_Sym *sym = &sec->symtab[j]; in read_symtabs()
358 struct section *sec = sec_lookup(".text"); in read_relocs() local
360 if (!sec) in read_relocs()
363 base = sec->shdr.sh_addr; in read_relocs()
367 struct section *sec = &secs[i]; in read_relocs() local
369 if (sec->shdr.sh_type != SHT_REL_TYPE) in read_relocs()
372 sec->reltab = malloc(sec->shdr.sh_size); in read_relocs()
373 if (!sec->reltab) in read_relocs()
375 sec->shdr.sh_size); in read_relocs()
377 if (fseek(fp, sec->shdr.sh_offset, SEEK_SET) < 0) in read_relocs()
379 sec->shdr.sh_offset, strerror(errno)); in read_relocs()
381 if (fread(sec->reltab, 1, sec->shdr.sh_size, fp) != in read_relocs()
382 sec->shdr.sh_size) in read_relocs()
385 for (j = 0; j < sec->shdr.sh_size/sizeof(Elf_Rel); j++) { in read_relocs()
386 Elf_Rel *rel = &sec->reltab[j]; in read_relocs()
413 struct section *sec = &secs[i]; in remove_relocs() local
415 if (sec->shdr.sh_type != SHT_REL_TYPE) in remove_relocs()
418 if (fseek(fp, sec->shdr_offset, SEEK_SET) < 0) in remove_relocs()
420 sec->shdr_offset, strerror(errno)); in remove_relocs()
432 if (fseek(fp, sec->shdr_offset, SEEK_SET) < 0) in remove_relocs()
434 sec->shdr_offset, strerror(errno)); in remove_relocs()
467 static void walk_relocs(int (*process)(struct section *sec, Elf_Rel *rel, in walk_relocs() argument
480 struct section *sec = &secs[i]; in walk_relocs() local
482 if (sec->shdr.sh_type != SHT_REL_TYPE) in walk_relocs()
485 if (sec->shdr.sh_info == extab_index) in walk_relocs()
488 sec_symtab = sec->link; in walk_relocs()
489 sec_applies = &secs[sec->shdr.sh_info]; in walk_relocs()
495 for (j = 0; j < sec->shdr.sh_size/sizeof(Elf_Rel); j++) { in walk_relocs()
496 Elf_Rel *rel = &sec->reltab[j]; in walk_relocs()
500 process(sec, rel, sym, symname); in walk_relocs()
505 static int do_reloc(struct section *sec, Elf_Rel *rel, Elf_Sym *sym, in do_reloc() argument
641 static int do_reloc_info(struct section *sec, Elf_Rel *rel, ElfW(Sym) *sym, in do_reloc_info() argument
645 sec_name(sec->shdr.sh_info), in do_reloc_info()