Lines Matching defs:shdr
38 Elf_Shdr *shdr;
64 elf_section_mappable(Elf_Shdr *shdr)
66 if (!(shdr->sh_flags & SHF_ALLOC)) {
69 if (shdr->sh_type != SHT_NOBITS &&
70 shdr->sh_type != SHT_PROGBITS) {
77 elf_can_drop_unmappable(Elf_Shdr *shdr)
80 * We found relocations from the section 'shdr' towards the rest of
81 * the binary, but 'shdr' is not mapped. Decide whether to skip the
91 if (shdr->sh_type == SHT_NOTE) {
130 if (eif.shdr[i].sh_name == 0) {
133 buf = eif.shstrtab + eif.shdr[i].sh_name;
135 return &eif.shdr[i];
184 if (!elf_section_mappable(&eif.shdr[sym->st_shndx])) {
277 Elf_Shdr *shdr;
281 shdr = (Elf_Shdr *)((uint8_t *)ehdr + ehdr->e_shoff);
283 size = (vaddr_t)shdr + (vaddr_t)(ehdr->e_shnum * sizeof(Elf_Shdr)) -
295 eif.shdr = (Elf_Shdr *)((uint8_t *)eif.ehdr + eif.ehdr->e_shoff);
314 if (eif.shdr[i].sh_type != SHT_STRTAB &&
315 eif.shdr[i].sh_type != SHT_REL &&
316 eif.shdr[i].sh_type != SHT_RELA &&
317 eif.shdr[i].sh_type != SHT_SYMTAB) {
320 if (eif.shdr[i].sh_offset == 0) {
326 offboot = basepa + eif.shdr[i].sh_offset - bootpa;
329 eif.shdr[i].sh_offset = (bootva + offboot - headva);
338 Elf_Shdr *shdr;
345 shdr = &eif.shdr[i];
347 if (!elf_section_mappable(shdr)) {
351 if (shdr->sh_flags & SHF_EXECINSTR) {
353 } else if (shdr->sh_flags & SHF_WRITE) {
358 secpa = basepa + shdr->sh_offset;
359 secsz = shdr->sh_size;
360 secalign = shdr->sh_addralign;
361 ASSERT(shdr->sh_offset != 0);
372 shdr->sh_offset = secva - headva;
389 eif.shstrtab = (char *)((uint8_t *)eif.ehdr + eif.shdr[j].sh_offset);
390 eif.shstrsz = eif.shdr[j].sh_size;
394 if (eif.shdr[i].sh_type == SHT_SYMTAB)
400 if (eif.shdr[i].sh_offset == 0) {
403 eif.symtab = (Elf_Sym *)((uint8_t *)eif.ehdr + eif.shdr[i].sh_offset);
404 eif.symcnt = eif.shdr[i].sh_size / sizeof(Elf_Sym);
407 j = eif.shdr[i].sh_link;
411 if (eif.shdr[j].sh_type != SHT_STRTAB) {
414 if (eif.shdr[j].sh_offset == 0) {
417 eif.strtab = (char *)((uint8_t *)eif.ehdr + eif.shdr[j].sh_offset);
418 eif.strsz = eif.shdr[j].sh_size;
435 if (!elf_section_mappable(&eif.shdr[i])) {
439 ASSERT(eif.shdr[i].sh_offset != 0);
440 secva = baseva + eif.shdr[i].sh_offset;
460 if (eif.shdr[i].sh_type != SHT_REL) {
463 ASSERT(eif.shdr[i].sh_offset != 0);
464 reltab = (Elf_Rel *)((uint8_t *)eif.ehdr + eif.shdr[i].sh_offset);
465 nrel = eif.shdr[i].sh_size / sizeof(Elf_Rel);
467 secidx = eif.shdr[i].sh_info;
471 if (!elf_section_mappable(&eif.shdr[secidx])) {
472 if (elf_can_drop_unmappable(&eif.shdr[secidx])) {
477 base = (uintptr_t)eif.ehdr + eif.shdr[secidx].sh_offset;
495 if (eif.shdr[i].sh_type != SHT_RELA) {
498 ASSERT(eif.shdr[i].sh_offset != 0);
499 relatab = (Elf_Rela *)((uint8_t *)eif.ehdr + eif.shdr[i].sh_offset);
500 nrela = eif.shdr[i].sh_size / sizeof(Elf_Rela);
502 secidx = eif.shdr[i].sh_info;
506 if (!elf_section_mappable(&eif.shdr[secidx])) {
507 if (elf_can_drop_unmappable(&eif.shdr[secidx])) {
512 base = (uintptr_t)eif.ehdr + eif.shdr[secidx].sh_offset;