Lines Matching refs:shdr
42 Elf64_Shdr *shdr; member
111 Elf64_Shdr *shdr; member
286 symtab->shdr->sh_size += sizeof(*sym); in add_new_sym()
351 sec->shdr = elf64_getshdr(sec->scn); in init_output_elf()
352 if (!sec->shdr) in init_output_elf()
369 sec->shdr->sh_name = str_off; in init_output_elf()
370 sec->shdr->sh_type = SHT_STRTAB; in init_output_elf()
371 sec->shdr->sh_flags = SHF_STRINGS; in init_output_elf()
372 sec->shdr->sh_offset = 0; in init_output_elf()
373 sec->shdr->sh_link = 0; in init_output_elf()
374 sec->shdr->sh_info = 0; in init_output_elf()
375 sec->shdr->sh_addralign = 1; in init_output_elf()
376 sec->shdr->sh_size = sec->sec_sz = 0; in init_output_elf()
377 sec->shdr->sh_entsize = 0; in init_output_elf()
390 sec->shdr = elf64_getshdr(sec->scn); in init_output_elf()
391 if (!sec->shdr) in init_output_elf()
407 sec->shdr->sh_name = str_off; in init_output_elf()
408 sec->shdr->sh_type = SHT_SYMTAB; in init_output_elf()
409 sec->shdr->sh_flags = 0; in init_output_elf()
410 sec->shdr->sh_offset = 0; in init_output_elf()
411 sec->shdr->sh_link = linker->strtab_sec_idx; in init_output_elf()
415 sec->shdr->sh_info = 0; in init_output_elf()
416 sec->shdr->sh_addralign = 8; in init_output_elf()
417 sec->shdr->sh_entsize = sizeof(Elf64_Sym); in init_output_elf()
481 Elf64_Shdr *shdr = sec->shdr; in is_ignored_sec() local
485 if (shdr->sh_type == SHT_STRTAB) in is_ignored_sec()
489 if (shdr->sh_type == SHT_LLVM_ADDRSIG) in is_ignored_sec()
493 if (shdr->sh_type == SHT_PROGBITS && shdr->sh_size == 0 && in is_ignored_sec()
553 Elf64_Shdr *shdr; in linker_load_obj_file() local
604 shdr = elf64_getshdr(scn); in linker_load_obj_file()
605 if (!shdr) { in linker_load_obj_file()
612 sec_name = elf_strptr(obj->elf, obj->shstrs_sec_idx, shdr->sh_name); in linker_load_obj_file()
633 sec->shdr = shdr; in linker_load_obj_file()
642 switch (shdr->sh_type) { in linker_load_obj_file()
656 obj->btf = btf__new(data->d_buf, shdr->sh_size); in linker_load_obj_file()
666 obj->btf_ext = btf_ext__new(data->d_buf, shdr->sh_size); in linker_load_obj_file()
722 if (sec->shdr->sh_addralign && !is_pow_of_2(sec->shdr->sh_addralign)) in linker_sanity_check_elf()
724 if (sec->shdr->sh_addralign != sec->data->d_align) in linker_sanity_check_elf()
727 if (sec->shdr->sh_size != sec->data->d_size) in linker_sanity_check_elf()
730 switch (sec->shdr->sh_type) { in linker_sanity_check_elf()
739 if (sec->shdr->sh_flags & SHF_EXECINSTR) { in linker_sanity_check_elf()
740 if (sec->shdr->sh_size % sizeof(struct bpf_insn) != 0) in linker_sanity_check_elf()
755 sec->sec_idx, sec->sec_name, (size_t)sec->shdr->sh_type, obj->filename); in linker_sanity_check_elf()
769 if (sec->shdr->sh_entsize != sizeof(Elf64_Sym)) in linker_sanity_check_elf_symtab()
771 if (sec->shdr->sh_size % sec->shdr->sh_entsize != 0) in linker_sanity_check_elf_symtab()
774 if (!sec->shdr->sh_link || sec->shdr->sh_link >= obj->sec_cnt) { in linker_sanity_check_elf_symtab()
776 sec->sec_idx, (size_t)sec->shdr->sh_link, obj->filename); in linker_sanity_check_elf_symtab()
779 link_sec = &obj->secs[sec->shdr->sh_link]; in linker_sanity_check_elf_symtab()
780 if (link_sec->shdr->sh_type != SHT_STRTAB) { in linker_sanity_check_elf_symtab()
782 sec->sec_idx, (size_t)sec->shdr->sh_link, obj->filename); in linker_sanity_check_elf_symtab()
786 n = sec->shdr->sh_size / sec->shdr->sh_entsize; in linker_sanity_check_elf_symtab()
843 if (sec->shdr->sh_entsize != sizeof(Elf64_Rel)) in linker_sanity_check_elf_relos()
845 if (sec->shdr->sh_size % sec->shdr->sh_entsize != 0) in linker_sanity_check_elf_relos()
849 if (sec->shdr->sh_link != obj->symtab_sec_idx) { in linker_sanity_check_elf_relos()
851 sec->sec_idx, (size_t)sec->shdr->sh_link, obj->filename); in linker_sanity_check_elf_relos()
856 if (!sec->shdr->sh_info || sec->shdr->sh_info >= obj->sec_cnt) { in linker_sanity_check_elf_relos()
858 sec->sec_idx, (size_t)sec->shdr->sh_info, obj->filename); in linker_sanity_check_elf_relos()
861 link_sec = &obj->secs[sec->shdr->sh_info]; in linker_sanity_check_elf_relos()
876 if (link_sec->shdr->sh_type != SHT_PROGBITS && link_sec->shdr->sh_type != SHT_NOBITS) { in linker_sanity_check_elf_relos()
878 sec->sec_idx, (size_t)sec->shdr->sh_info, obj->filename); in linker_sanity_check_elf_relos()
883 n = sec->shdr->sh_size / sec->shdr->sh_entsize; in linker_sanity_check_elf_relos()
897 if (!sym_idx || sym_idx * sizeof(Elf64_Sym) >= sym_sec->shdr->sh_size) { in linker_sanity_check_elf_relos()
903 if (link_sec->shdr->sh_flags & SHF_EXECINSTR) { in linker_sanity_check_elf_relos()
982 Elf64_Shdr *shdr; in init_sec() local
999 shdr = elf64_getshdr(scn); in init_sec()
1000 if (!shdr) in init_sec()
1004 dst_sec->shdr = shdr; in init_sec()
1012 shdr->sh_name = name_off; in init_sec()
1013 shdr->sh_type = src_sec->shdr->sh_type; in init_sec()
1014 shdr->sh_flags = src_sec->shdr->sh_flags; in init_sec()
1015 shdr->sh_size = 0; in init_sec()
1020 shdr->sh_link = 0; in init_sec()
1021 shdr->sh_info = 0; in init_sec()
1022 shdr->sh_addralign = src_sec->shdr->sh_addralign; in init_sec()
1023 shdr->sh_entsize = src_sec->shdr->sh_entsize; in init_sec()
1054 if (dst->shdr->sh_type != src->shdr->sh_type) { in secs_match()
1058 if (dst->shdr->sh_flags != src->shdr->sh_flags) { in secs_match()
1062 if (dst->shdr->sh_entsize != src->shdr->sh_entsize) { in secs_match()
1072 if (dst_sec->sec_sz != src_sec->shdr->sh_size) in sec_content_is_same()
1104 dst_align = dst->shdr->sh_addralign; in extend_sec()
1105 src_align = src->shdr->sh_addralign; in extend_sec()
1114 dst_final_sz = dst_align_sz + src->shdr->sh_size; in extend_sec()
1116 if (src->shdr->sh_type != SHT_NOBITS) { in extend_sec()
1125 memcpy(dst->raw_data + dst_align_sz, src->data->d_buf, src->shdr->sh_size); in extend_sec()
1129 dst->shdr->sh_size = dst_final_sz; in extend_sec()
1132 dst->shdr->sh_addralign = dst_align; in extend_sec()
1147 return sec->shdr->sh_type == SHT_PROGBITS || sec->shdr->sh_type == SHT_NOBITS; in is_data_sec()
1154 return sec->shdr->sh_type == SHT_REL; in is_relo_sec()
1213 int i, n = symtab->shdr->sh_size / symtab->shdr->sh_entsize, err; in linker_append_elf_syms()
1214 int str_sec_idx = symtab->shdr->sh_link; in linker_append_elf_syms()
2014 src_linked_sec = &obj->secs[src_sec->shdr->sh_info]; in linker_append_elf_relos()
2037 dst_sec->shdr->sh_link = linker->symtab_sec_idx; in linker_append_elf_relos()
2041 dst_sec->shdr->sh_info = dst_linked_sec->sec_idx; in linker_append_elf_relos()
2050 n = src_sec->shdr->sh_size / src_sec->shdr->sh_entsize; in linker_append_elf_relos()
2070 if (src_linked_sec->shdr->sh_flags & SHF_EXECINSTR) { in linker_append_elf_relos()
2102 int i, n = symtab->shdr->sh_size / symtab->shdr->sh_entsize; in find_sym_by_name()
2103 int str_sec_idx = symtab->shdr->sh_link; in find_sym_by_name()
2147 if (sec->shdr) in linker_fixup_btf()
2148 t->size = sec->shdr->sh_size; in linker_fixup_btf()
2573 sec->shdr->sh_size = strs_sz; in bpf_linker__finalize()
2617 Elf64_Shdr *shdr; in emit_elf_data_sec() local
2630 shdr = elf64_getshdr(scn); in emit_elf_data_sec()
2631 if (!shdr) in emit_elf_data_sec()
2634 shdr->sh_name = name_off; in emit_elf_data_sec()
2635 shdr->sh_type = SHT_PROGBITS; in emit_elf_data_sec()
2636 shdr->sh_flags = 0; in emit_elf_data_sec()
2637 shdr->sh_size = raw_sz; in emit_elf_data_sec()
2638 shdr->sh_link = 0; in emit_elf_data_sec()
2639 shdr->sh_info = 0; in emit_elf_data_sec()
2640 shdr->sh_addralign = align; in emit_elf_data_sec()
2641 shdr->sh_entsize = 0; in emit_elf_data_sec()