Lines Matching refs:sec
272 struct section *sec = &secs[i]; in sym_lookup() local
278 if (sec->shdr.sh_type != SHT_SYMTAB) in sym_lookup()
281 nsyms = sec->shdr.sh_size/sizeof(Elf_Sym); in sym_lookup()
282 symtab = sec->symtab; in sym_lookup()
283 strtab = sec->link->strtab; in sym_lookup()
404 struct section *sec = &secs[i]; in read_shdrs() local
408 sec->shdr.sh_name = elf_word_to_cpu(shdr.sh_name); in read_shdrs()
409 sec->shdr.sh_type = elf_word_to_cpu(shdr.sh_type); in read_shdrs()
410 sec->shdr.sh_flags = elf_xword_to_cpu(shdr.sh_flags); in read_shdrs()
411 sec->shdr.sh_addr = elf_addr_to_cpu(shdr.sh_addr); in read_shdrs()
412 sec->shdr.sh_offset = elf_off_to_cpu(shdr.sh_offset); in read_shdrs()
413 sec->shdr.sh_size = elf_xword_to_cpu(shdr.sh_size); in read_shdrs()
414 sec->shdr.sh_link = elf_word_to_cpu(shdr.sh_link); in read_shdrs()
415 sec->shdr.sh_info = elf_word_to_cpu(shdr.sh_info); in read_shdrs()
416 sec->shdr.sh_addralign = elf_xword_to_cpu(shdr.sh_addralign); in read_shdrs()
417 sec->shdr.sh_entsize = elf_xword_to_cpu(shdr.sh_entsize); in read_shdrs()
418 if (sec->shdr.sh_link < ehdr.e_shnum) in read_shdrs()
419 sec->link = &secs[sec->shdr.sh_link]; in read_shdrs()
428 struct section *sec = &secs[i]; in read_strtabs() local
429 if (sec->shdr.sh_type != SHT_STRTAB) { in read_strtabs()
432 sec->strtab = malloc(sec->shdr.sh_size); in read_strtabs()
433 if (!sec->strtab) { in read_strtabs()
435 sec->shdr.sh_size); in read_strtabs()
437 if (fseek(fp, sec->shdr.sh_offset, SEEK_SET) < 0) { in read_strtabs()
439 sec->shdr.sh_offset, strerror(errno)); in read_strtabs()
441 if (fread(sec->strtab, 1, sec->shdr.sh_size, fp) in read_strtabs()
442 != sec->shdr.sh_size) { in read_strtabs()
453 struct section *sec = &secs[i]; in read_symtabs() local
454 if (sec->shdr.sh_type != SHT_SYMTAB) { in read_symtabs()
457 sec->symtab = malloc(sec->shdr.sh_size); in read_symtabs()
458 if (!sec->symtab) { in read_symtabs()
460 sec->shdr.sh_size); in read_symtabs()
462 if (fseek(fp, sec->shdr.sh_offset, SEEK_SET) < 0) { in read_symtabs()
464 sec->shdr.sh_offset, strerror(errno)); in read_symtabs()
466 if (fread(sec->symtab, 1, sec->shdr.sh_size, fp) in read_symtabs()
467 != sec->shdr.sh_size) { in read_symtabs()
471 for (j = 0; j < sec->shdr.sh_size/sizeof(Elf_Sym); j++) { in read_symtabs()
472 Elf_Sym *sym = &sec->symtab[j]; in read_symtabs()
486 struct section *sec = &secs[i]; in read_relocs() local
487 if (sec->shdr.sh_type != SHT_REL_TYPE) { in read_relocs()
490 sec->reltab = malloc(sec->shdr.sh_size); in read_relocs()
491 if (!sec->reltab) { in read_relocs()
493 sec->shdr.sh_size); in read_relocs()
495 if (fseek(fp, sec->shdr.sh_offset, SEEK_SET) < 0) { in read_relocs()
497 sec->shdr.sh_offset, strerror(errno)); in read_relocs()
499 if (fread(sec->reltab, 1, sec->shdr.sh_size, fp) in read_relocs()
500 != sec->shdr.sh_size) { in read_relocs()
504 for (j = 0; j < sec->shdr.sh_size/sizeof(Elf_Rel); j++) { in read_relocs()
505 Elf_Rel *rel = &sec->reltab[j]; in read_relocs()
529 struct section *sec = &secs[i]; in print_absolute_symbols() local
533 if (sec->shdr.sh_type != SHT_SYMTAB) { in print_absolute_symbols()
536 sym_strtab = sec->link->strtab; in print_absolute_symbols()
537 for (j = 0; j < sec->shdr.sh_size/sizeof(Elf_Sym); j++) { in print_absolute_symbols()
540 sym = &sec->symtab[j]; in print_absolute_symbols()
567 struct section *sec = &secs[i]; in print_absolute_relocs() local
572 if (sec->shdr.sh_type != SHT_REL_TYPE) { in print_absolute_relocs()
575 sec_symtab = sec->link; in print_absolute_relocs()
576 sec_applies = &secs[sec->shdr.sh_info]; in print_absolute_relocs()
582 for (j = 0; j < sec->shdr.sh_size/sizeof(Elf_Rel); j++) { in print_absolute_relocs()
586 rel = &sec->reltab[j]; in print_absolute_relocs()
645 static void walk_relocs(int (*process)(struct section *sec, Elf_Rel *rel, in walk_relocs() argument
655 struct section *sec = &secs[i]; in walk_relocs() local
657 if (sec->shdr.sh_type != SHT_REL_TYPE) { in walk_relocs()
660 sec_symtab = sec->link; in walk_relocs()
661 sec_applies = &secs[sec->shdr.sh_info]; in walk_relocs()
667 for (j = 0; j < sec->shdr.sh_size/sizeof(Elf_Rel); j++) { in walk_relocs()
668 Elf_Rel *rel = &sec->reltab[j]; in walk_relocs()
672 process(sec, rel, sym, symname); in walk_relocs()
750 static int do_reloc64(struct section *sec, Elf_Rel *rel, ElfW(Sym) *sym, in do_reloc64() argument
763 if (sec->shdr.sh_info == per_cpu_shndx) in do_reloc64()
828 static int do_reloc32(struct section *sec, Elf_Rel *rel, Elf_Sym *sym, in do_reloc32() argument
871 static int do_reloc_real(struct section *sec, Elf_Rel *rel, Elf_Sym *sym, in do_reloc_real() argument
973 int (*do_reloc)(struct section *sec, Elf_Rel *rel, Elf_Sym *sym, in emit_relocs()
1052 static int do_reloc_info(struct section *sec, Elf_Rel *rel, ElfW(Sym) *sym, in do_reloc_info() argument
1056 sec_name(sec->shdr.sh_info), in do_reloc_info()