Lines Matching full:sec
191 struct section *sec = &secs[i]; in read_shdrs() local
193 sec->shdr_offset = ftell(fp); in read_shdrs()
194 if (fread(&sec->shdr, sizeof(Elf_Shdr), 1, fp) != 1) in read_shdrs()
198 if (sec->shdr.sh_link < ehdr.e_shnum) in read_shdrs()
199 sec->link = &secs[sec->shdr.sh_link]; in read_shdrs()
208 struct section *sec = &secs[i]; in read_strtabs() local
210 if (sec->shdr.sh_type != SHT_STRTAB) in read_strtabs()
213 sec->strtab = malloc(sec->shdr.sh_size); in read_strtabs()
214 if (!sec->strtab) in read_strtabs()
216 sec->shdr.sh_size); in read_strtabs()
218 if (fseek(fp, sec->shdr.sh_offset, SEEK_SET) < 0) in read_strtabs()
220 sec->shdr.sh_offset, strerror(errno)); in read_strtabs()
222 if (fread(sec->strtab, 1, sec->shdr.sh_size, fp) != in read_strtabs()
223 sec->shdr.sh_size) in read_strtabs()
233 struct section *sec = &secs[i]; in read_symtabs() local
234 if (sec->shdr.sh_type != SHT_SYMTAB) in read_symtabs()
237 sec->symtab = malloc(sec->shdr.sh_size); in read_symtabs()
238 if (!sec->symtab) in read_symtabs()
240 sec->shdr.sh_size); in read_symtabs()
242 if (fseek(fp, sec->shdr.sh_offset, SEEK_SET) < 0) in read_symtabs()
244 sec->shdr.sh_offset, strerror(errno)); in read_symtabs()
246 if (fread(sec->symtab, 1, sec->shdr.sh_size, fp) != in read_symtabs()
247 sec->shdr.sh_size) in read_symtabs()
258 struct section *sec = sec_lookup(".text"); in read_relocs() local
260 if (!sec) in read_relocs()
263 base = sec->shdr.sh_addr; in read_relocs()
267 struct section *sec = &secs[i]; in read_relocs() local
269 if (sec->shdr.sh_type != SHT_REL_TYPE) in read_relocs()
272 sec->reltab = malloc(sec->shdr.sh_size); in read_relocs()
273 if (!sec->reltab) in read_relocs()
275 sec->shdr.sh_size); in read_relocs()
277 if (fseek(fp, sec->shdr.sh_offset, SEEK_SET) < 0) in read_relocs()
279 sec->shdr.sh_offset, strerror(errno)); in read_relocs()
281 if (fread(sec->reltab, 1, sec->shdr.sh_size, fp) != in read_relocs()
282 sec->shdr.sh_size) in read_relocs()
285 for (j = 0; j < sec->shdr.sh_size/sizeof(Elf_Rel); j++) { in read_relocs()
286 Elf_Rel *rel = &sec->reltab[j]; in read_relocs()
300 struct section *sec = &secs[i]; in remove_relocs() local
302 if (sec->shdr.sh_type != SHT_REL_TYPE) in remove_relocs()
305 if (fseek(fp, sec->shdr_offset, SEEK_SET) < 0) in remove_relocs()
307 sec->shdr_offset, strerror(errno)); in remove_relocs()
319 if (fseek(fp, sec->shdr_offset, SEEK_SET) < 0) in remove_relocs()
321 sec->shdr_offset, strerror(errno)); in remove_relocs()
354 static void walk_relocs(int (*process)(struct section *sec, Elf_Rel *rel, in walk_relocs() argument
365 struct section *sec = &secs[i]; in walk_relocs() local
367 if (sec->shdr.sh_type != SHT_REL_TYPE) in walk_relocs()
370 sec_symtab = sec->link; in walk_relocs()
371 sec_applies = &secs[sec->shdr.sh_info]; in walk_relocs()
377 for (j = 0; j < sec->shdr.sh_size/sizeof(Elf_Rel); j++) { in walk_relocs()
378 Elf_Rel *rel = &sec->reltab[j]; in walk_relocs()
382 process(sec, rel, sym, symname); in walk_relocs()
387 static int do_reloc(struct section *sec, Elf_Rel *rel, Elf_Sym *sym, in do_reloc() argument
523 static int do_reloc_info(struct section *sec, Elf_Rel *rel, ElfW(Sym) *sym, in do_reloc_info() argument
527 sec_name(sec->shdr.sh_info), in do_reloc_info()