Lines Matching refs:sec

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