Lines Matching refs:shdr
47 Elf64_Shdr *shdr; member
116 Elf64_Shdr *shdr; member
350 symtab->shdr->sh_size += sizeof(*sym); in add_new_sym()
399 sec->shdr = elf64_getshdr(sec->scn); in init_output_elf()
400 if (!sec->shdr) in init_output_elf()
417 sec->shdr->sh_name = str_off; in init_output_elf()
418 sec->shdr->sh_type = SHT_STRTAB; in init_output_elf()
419 sec->shdr->sh_flags = SHF_STRINGS; in init_output_elf()
420 sec->shdr->sh_offset = 0; in init_output_elf()
421 sec->shdr->sh_link = 0; in init_output_elf()
422 sec->shdr->sh_info = 0; in init_output_elf()
423 sec->shdr->sh_addralign = 1; in init_output_elf()
424 sec->shdr->sh_size = sec->sec_sz = 0; in init_output_elf()
425 sec->shdr->sh_entsize = 0; in init_output_elf()
438 sec->shdr = elf64_getshdr(sec->scn); in init_output_elf()
439 if (!sec->shdr) in init_output_elf()
457 sec->shdr->sh_name = str_off; in init_output_elf()
458 sec->shdr->sh_type = SHT_SYMTAB; in init_output_elf()
459 sec->shdr->sh_flags = 0; in init_output_elf()
460 sec->shdr->sh_offset = 0; in init_output_elf()
461 sec->shdr->sh_link = linker->strtab_sec_idx; in init_output_elf()
465 sec->shdr->sh_info = 0; in init_output_elf()
466 sec->shdr->sh_addralign = 8; in init_output_elf()
467 sec->shdr->sh_entsize = sizeof(Elf64_Sym); in init_output_elf()
607 Elf64_Shdr *shdr = sec->shdr; in is_ignored_sec() local
611 if (shdr->sh_type == SHT_STRTAB) in is_ignored_sec()
615 if (shdr->sh_type == SHT_LLVM_ADDRSIG) in is_ignored_sec()
619 if (shdr->sh_type == SHT_PROGBITS && shdr->sh_size == 0 && in is_ignored_sec()
671 Elf64_Shdr *shdr; in linker_load_obj_file() local
734 shdr = elf64_getshdr(scn); in linker_load_obj_file()
735 if (!shdr) { in linker_load_obj_file()
741 sec_name = elf_strptr(obj->elf, obj->shstrs_sec_idx, shdr->sh_name); in linker_load_obj_file()
760 sec->shdr = shdr; in linker_load_obj_file()
769 switch (shdr->sh_type) { in linker_load_obj_file()
783 obj->btf = btf__new(data->d_buf, shdr->sh_size); in linker_load_obj_file()
794 obj->btf_ext = btf_ext__new(data->d_buf, shdr->sh_size); in linker_load_obj_file()
854 if (sec->shdr->sh_addralign && !is_pow_of_2(sec->shdr->sh_addralign)) { in linker_sanity_check_elf()
856 sec->sec_idx, (long long unsigned)sec->shdr->sh_addralign, in linker_sanity_check_elf()
860 if (sec->shdr->sh_addralign != sec->data->d_align) { in linker_sanity_check_elf()
862 sec->sec_idx, (long long unsigned)sec->shdr->sh_addralign, in linker_sanity_check_elf()
867 if (sec->shdr->sh_size != sec->data->d_size) { in linker_sanity_check_elf()
869 sec->sec_idx, (long long unsigned)sec->shdr->sh_size, in linker_sanity_check_elf()
874 switch (sec->shdr->sh_type) { in linker_sanity_check_elf()
883 if (sec->shdr->sh_flags & SHF_EXECINSTR) { in linker_sanity_check_elf()
884 if (sec->shdr->sh_size % sizeof(struct bpf_insn) != 0) { in linker_sanity_check_elf()
886 sec->sec_idx, (long long unsigned)sec->shdr->sh_size, in linker_sanity_check_elf()
903 sec->sec_idx, sec->sec_name, (size_t)sec->shdr->sh_type, obj->filename); in linker_sanity_check_elf()
917 if (sec->shdr->sh_entsize != sizeof(Elf64_Sym)) in linker_sanity_check_elf_symtab()
919 if (sec->shdr->sh_size % sec->shdr->sh_entsize != 0) in linker_sanity_check_elf_symtab()
922 if (!sec->shdr->sh_link || sec->shdr->sh_link >= obj->sec_cnt) { in linker_sanity_check_elf_symtab()
924 sec->sec_idx, (size_t)sec->shdr->sh_link, obj->filename); in linker_sanity_check_elf_symtab()
927 link_sec = &obj->secs[sec->shdr->sh_link]; in linker_sanity_check_elf_symtab()
928 if (link_sec->shdr->sh_type != SHT_STRTAB) { in linker_sanity_check_elf_symtab()
930 sec->sec_idx, (size_t)sec->shdr->sh_link, obj->filename); in linker_sanity_check_elf_symtab()
934 n = sec->shdr->sh_size / sec->shdr->sh_entsize; in linker_sanity_check_elf_symtab()
991 if (sec->shdr->sh_entsize != sizeof(Elf64_Rel)) in linker_sanity_check_elf_relos()
993 if (sec->shdr->sh_size % sec->shdr->sh_entsize != 0) in linker_sanity_check_elf_relos()
997 if (sec->shdr->sh_link != obj->symtab_sec_idx) { in linker_sanity_check_elf_relos()
999 sec->sec_idx, (size_t)sec->shdr->sh_link, obj->filename); in linker_sanity_check_elf_relos()
1004 if (!sec->shdr->sh_info || sec->shdr->sh_info >= obj->sec_cnt) { in linker_sanity_check_elf_relos()
1006 sec->sec_idx, (size_t)sec->shdr->sh_info, obj->filename); in linker_sanity_check_elf_relos()
1009 link_sec = &obj->secs[sec->shdr->sh_info]; in linker_sanity_check_elf_relos()
1024 if (link_sec->shdr->sh_type != SHT_PROGBITS && link_sec->shdr->sh_type != SHT_NOBITS) { in linker_sanity_check_elf_relos()
1026 sec->sec_idx, (size_t)sec->shdr->sh_info, obj->filename); in linker_sanity_check_elf_relos()
1031 n = sec->shdr->sh_size / sec->shdr->sh_entsize; in linker_sanity_check_elf_relos()
1045 if (!sym_idx || sym_idx * sizeof(Elf64_Sym) >= sym_sec->shdr->sh_size) { in linker_sanity_check_elf_relos()
1051 if (link_sec->shdr->sh_flags & SHF_EXECINSTR) { in linker_sanity_check_elf_relos()
1144 Elf64_Shdr *shdr; in init_sec() local
1161 shdr = elf64_getshdr(scn); in init_sec()
1162 if (!shdr) in init_sec()
1166 dst_sec->shdr = shdr; in init_sec()
1174 shdr->sh_name = name_off; in init_sec()
1175 shdr->sh_type = src_sec->shdr->sh_type; in init_sec()
1176 shdr->sh_flags = src_sec->shdr->sh_flags; in init_sec()
1177 shdr->sh_size = 0; in init_sec()
1182 shdr->sh_link = 0; in init_sec()
1183 shdr->sh_info = 0; in init_sec()
1184 shdr->sh_addralign = src_sec->shdr->sh_addralign; in init_sec()
1185 shdr->sh_entsize = src_sec->shdr->sh_entsize; in init_sec()
1216 if (dst->shdr->sh_type != src->shdr->sh_type) { in secs_match()
1220 if (dst->shdr->sh_flags != src->shdr->sh_flags) { in secs_match()
1224 if (dst->shdr->sh_entsize != src->shdr->sh_entsize) { in secs_match()
1234 if (dst_sec->sec_sz != src_sec->shdr->sh_size) in sec_content_is_same()
1245 return (sec->shdr->sh_type == SHT_PROGBITS) && in is_exec_sec()
1246 (sec->shdr->sh_flags & SHF_EXECINSTR); in is_exec_sec()
1284 dst_align = dst->shdr->sh_addralign; in extend_sec()
1285 src_align = src->shdr->sh_addralign; in extend_sec()
1294 dst_final_sz = dst_align_sz + src->shdr->sh_size; in extend_sec()
1296 if (src->shdr->sh_type != SHT_NOBITS) { in extend_sec()
1317 memcpy(dst->raw_data + dst_align_sz, src->data->d_buf, src->shdr->sh_size); in extend_sec()
1321 exec_sec_bswap(dst->raw_data + dst_align_sz, src->shdr->sh_size); in extend_sec()
1325 dst->shdr->sh_size = dst_final_sz; in extend_sec()
1328 dst->shdr->sh_addralign = dst_align; in extend_sec()
1343 return sec->shdr->sh_type == SHT_PROGBITS || sec->shdr->sh_type == SHT_NOBITS; in is_data_sec()
1350 return sec->shdr->sh_type == SHT_REL; in is_relo_sec()
1409 int i, n = symtab->shdr->sh_size / symtab->shdr->sh_entsize, err; in linker_append_elf_syms()
1410 int str_sec_idx = symtab->shdr->sh_link; in linker_append_elf_syms()
2212 src_linked_sec = &obj->secs[src_sec->shdr->sh_info]; in linker_append_elf_relos()
2232 dst_sec->shdr->sh_link = linker->symtab_sec_idx; in linker_append_elf_relos()
2236 dst_sec->shdr->sh_info = dst_linked_sec->sec_idx; in linker_append_elf_relos()
2245 n = src_sec->shdr->sh_size / src_sec->shdr->sh_entsize; in linker_append_elf_relos()
2262 if (src_linked_sec->shdr->sh_flags & SHF_EXECINSTR) { in linker_append_elf_relos()
2294 int i, n = symtab->shdr->sh_size / symtab->shdr->sh_entsize; in find_sym_by_name()
2295 int str_sec_idx = symtab->shdr->sh_link; in find_sym_by_name()
2339 if (sec->shdr) in linker_fixup_btf()
2340 t->size = sec->shdr->sh_size; in linker_fixup_btf()
2776 sec->shdr->sh_size = strs_sz; in bpf_linker__finalize()
2825 Elf64_Shdr *shdr; in emit_elf_data_sec() local
2838 shdr = elf64_getshdr(scn); in emit_elf_data_sec()
2839 if (!shdr) in emit_elf_data_sec()
2842 shdr->sh_name = name_off; in emit_elf_data_sec()
2843 shdr->sh_type = SHT_PROGBITS; in emit_elf_data_sec()
2844 shdr->sh_flags = 0; in emit_elf_data_sec()
2845 shdr->sh_size = raw_sz; in emit_elf_data_sec()
2846 shdr->sh_link = 0; in emit_elf_data_sec()
2847 shdr->sh_info = 0; in emit_elf_data_sec()
2848 shdr->sh_addralign = align; in emit_elf_data_sec()
2849 shdr->sh_entsize = 0; in emit_elf_data_sec()