Lines Matching refs:shdr
25 Elf_Shdr shdr; member
98 name = sec_strtab + secs[shndx].shdr.sh_name; in sec_name()
263 Elf_Shdr shdr; in read_shdrs() local
276 if (fread(&shdr, sizeof(shdr), 1, fp) != 1) 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()
301 if (sec->shdr.sh_type != SHT_STRTAB) in read_strtabs()
304 sec->strtab = malloc(sec->shdr.sh_size); 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()
325 if (sec->shdr.sh_type != SHT_SYMTAB) in read_symtabs()
328 sec->symtab = malloc(sec->shdr.sh_size); 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()
363 base = sec->shdr.sh_addr; in read_relocs()
369 if (sec->shdr.sh_type != SHT_REL_TYPE) in read_relocs()
372 sec->reltab = malloc(sec->shdr.sh_size); 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()
410 Elf_Shdr shdr; in remove_relocs() local
415 if (sec->shdr.sh_type != SHT_REL_TYPE) in remove_relocs()
422 if (fread(&shdr, sizeof(shdr), 1, fp) != 1) in remove_relocs()
430 shdr.sh_size = 0; in remove_relocs()
436 if (fwrite(&shdr, sizeof(shdr), 1, fp) != 1) in remove_relocs()
480 if (sec->shdr.sh_type != SHT_REL_TYPE) in walk_relocs()
484 sec_applies = &secs[sec->shdr.sh_info]; in walk_relocs()
485 if (!(sec_applies->shdr.sh_flags & SHF_ALLOC)) in walk_relocs()
490 for (j = 0; j < sec->shdr.sh_size/sizeof(Elf_Rel); j++) { in walk_relocs()
584 size_reserved = sec_reloc->shdr.sh_size; in emit_relocs()
607 if (fseek(outf, sec_reloc->shdr.sh_offset, SEEK_SET) < 0) { in emit_relocs()
609 sec_reloc->shdr.sh_offset, strerror(errno)); in emit_relocs()
640 sec_name(sec->shdr.sh_info), in do_reloc_info()