Lines Matching refs:shdr
48 Elf64_Shdr *shdr; member
117 Elf64_Shdr *shdr; member
351 symtab->shdr->sh_size += sizeof(*sym); in add_new_sym()
400 sec->shdr = elf64_getshdr(sec->scn); in init_output_elf()
401 if (!sec->shdr) in init_output_elf()
418 sec->shdr->sh_name = str_off; in init_output_elf()
419 sec->shdr->sh_type = SHT_STRTAB; in init_output_elf()
420 sec->shdr->sh_flags = SHF_STRINGS; in init_output_elf()
421 sec->shdr->sh_offset = 0; in init_output_elf()
422 sec->shdr->sh_link = 0; in init_output_elf()
423 sec->shdr->sh_info = 0; in init_output_elf()
424 sec->shdr->sh_addralign = 1; in init_output_elf()
425 sec->shdr->sh_size = sec->sec_sz = 0; in init_output_elf()
426 sec->shdr->sh_entsize = 0; in init_output_elf()
439 sec->shdr = elf64_getshdr(sec->scn); in init_output_elf()
440 if (!sec->shdr) in init_output_elf()
458 sec->shdr->sh_name = str_off; in init_output_elf()
459 sec->shdr->sh_type = SHT_SYMTAB; in init_output_elf()
460 sec->shdr->sh_flags = 0; in init_output_elf()
461 sec->shdr->sh_offset = 0; in init_output_elf()
462 sec->shdr->sh_link = linker->strtab_sec_idx; in init_output_elf()
466 sec->shdr->sh_info = 0; in init_output_elf()
467 sec->shdr->sh_addralign = 8; in init_output_elf()
468 sec->shdr->sh_entsize = sizeof(Elf64_Sym); in init_output_elf()
608 Elf64_Shdr *shdr = sec->shdr; in is_ignored_sec() local
612 if (shdr->sh_type == SHT_STRTAB) in is_ignored_sec()
616 if (shdr->sh_type == SHT_LLVM_ADDRSIG) in is_ignored_sec()
620 if (shdr->sh_type == SHT_PROGBITS && shdr->sh_size == 0 && in is_ignored_sec()
672 Elf64_Shdr *shdr; in linker_load_obj_file() local
735 shdr = elf64_getshdr(scn); in linker_load_obj_file()
736 if (!shdr) { in linker_load_obj_file()
742 sec_name = elf_strptr(obj->elf, obj->shstrs_sec_idx, shdr->sh_name); in linker_load_obj_file()
761 sec->shdr = shdr; in linker_load_obj_file()
770 switch (shdr->sh_type) { in linker_load_obj_file()
784 obj->btf = btf__new(data->d_buf, shdr->sh_size); in linker_load_obj_file()
795 obj->btf_ext = btf_ext__new(data->d_buf, shdr->sh_size); in linker_load_obj_file()
855 if (sec->shdr->sh_addralign && !is_pow_of_2(sec->shdr->sh_addralign)) { in linker_sanity_check_elf()
857 sec->sec_idx, (long long unsigned)sec->shdr->sh_addralign, in linker_sanity_check_elf()
861 if (sec->shdr->sh_addralign != sec->data->d_align) { in linker_sanity_check_elf()
863 sec->sec_idx, (long long unsigned)sec->shdr->sh_addralign, in linker_sanity_check_elf()
868 if (sec->shdr->sh_size != sec->data->d_size) { in linker_sanity_check_elf()
870 sec->sec_idx, (long long unsigned)sec->shdr->sh_size, in linker_sanity_check_elf()
875 switch (sec->shdr->sh_type) { in linker_sanity_check_elf()
884 if (sec->shdr->sh_flags & SHF_EXECINSTR) { in linker_sanity_check_elf()
885 if (sec->shdr->sh_size % sizeof(struct bpf_insn) != 0) { in linker_sanity_check_elf()
887 sec->sec_idx, (long long unsigned)sec->shdr->sh_size, in linker_sanity_check_elf()
904 sec->sec_idx, sec->sec_name, (size_t)sec->shdr->sh_type, obj->filename); in linker_sanity_check_elf()
918 if (sec->shdr->sh_entsize != sizeof(Elf64_Sym)) in linker_sanity_check_elf_symtab()
920 if (sec->shdr->sh_size % sec->shdr->sh_entsize != 0) in linker_sanity_check_elf_symtab()
923 if (!sec->shdr->sh_link || sec->shdr->sh_link >= obj->sec_cnt) { in linker_sanity_check_elf_symtab()
925 sec->sec_idx, (size_t)sec->shdr->sh_link, obj->filename); in linker_sanity_check_elf_symtab()
928 link_sec = &obj->secs[sec->shdr->sh_link]; in linker_sanity_check_elf_symtab()
929 if (link_sec->shdr->sh_type != SHT_STRTAB) { in linker_sanity_check_elf_symtab()
931 sec->sec_idx, (size_t)sec->shdr->sh_link, obj->filename); in linker_sanity_check_elf_symtab()
935 n = sec->shdr->sh_size / sec->shdr->sh_entsize; in linker_sanity_check_elf_symtab()
992 if (sec->shdr->sh_entsize != sizeof(Elf64_Rel)) in linker_sanity_check_elf_relos()
994 if (sec->shdr->sh_size % sec->shdr->sh_entsize != 0) in linker_sanity_check_elf_relos()
998 if (sec->shdr->sh_link != obj->symtab_sec_idx) { in linker_sanity_check_elf_relos()
1000 sec->sec_idx, (size_t)sec->shdr->sh_link, obj->filename); in linker_sanity_check_elf_relos()
1005 if (!sec->shdr->sh_info || sec->shdr->sh_info >= obj->sec_cnt) { in linker_sanity_check_elf_relos()
1007 sec->sec_idx, (size_t)sec->shdr->sh_info, obj->filename); in linker_sanity_check_elf_relos()
1010 link_sec = &obj->secs[sec->shdr->sh_info]; in linker_sanity_check_elf_relos()
1025 if (link_sec->shdr->sh_type != SHT_PROGBITS && link_sec->shdr->sh_type != SHT_NOBITS) { in linker_sanity_check_elf_relos()
1027 sec->sec_idx, (size_t)sec->shdr->sh_info, obj->filename); in linker_sanity_check_elf_relos()
1032 n = sec->shdr->sh_size / sec->shdr->sh_entsize; in linker_sanity_check_elf_relos()
1046 if (!sym_idx || sym_idx * sizeof(Elf64_Sym) >= sym_sec->shdr->sh_size) { in linker_sanity_check_elf_relos()
1052 if (link_sec->shdr->sh_flags & SHF_EXECINSTR) { in linker_sanity_check_elf_relos()
1145 Elf64_Shdr *shdr; in init_sec() local
1162 shdr = elf64_getshdr(scn); in init_sec()
1163 if (!shdr) in init_sec()
1167 dst_sec->shdr = shdr; in init_sec()
1175 shdr->sh_name = name_off; in init_sec()
1176 shdr->sh_type = src_sec->shdr->sh_type; in init_sec()
1177 shdr->sh_flags = src_sec->shdr->sh_flags; in init_sec()
1178 shdr->sh_size = 0; in init_sec()
1183 shdr->sh_link = 0; in init_sec()
1184 shdr->sh_info = 0; in init_sec()
1185 shdr->sh_addralign = src_sec->shdr->sh_addralign; in init_sec()
1186 shdr->sh_entsize = src_sec->shdr->sh_entsize; in init_sec()
1217 if (dst->shdr->sh_type != src->shdr->sh_type) { in secs_match()
1221 if (dst->shdr->sh_flags != src->shdr->sh_flags) { in secs_match()
1225 if (dst->shdr->sh_entsize != src->shdr->sh_entsize) { in secs_match()
1235 if (dst_sec->sec_sz != src_sec->shdr->sh_size) in sec_content_is_same()
1246 return (sec->shdr->sh_type == SHT_PROGBITS) && in is_exec_sec()
1247 (sec->shdr->sh_flags & SHF_EXECINSTR); in is_exec_sec()
1285 dst_align = dst->shdr->sh_addralign; in extend_sec()
1286 src_align = src->shdr->sh_addralign; in extend_sec()
1295 dst_final_sz = dst_align_sz + src->shdr->sh_size; in extend_sec()
1297 if (src->shdr->sh_type != SHT_NOBITS) { in extend_sec()
1318 memcpy(dst->raw_data + dst_align_sz, src->data->d_buf, src->shdr->sh_size); in extend_sec()
1322 exec_sec_bswap(dst->raw_data + dst_align_sz, src->shdr->sh_size); in extend_sec()
1326 dst->shdr->sh_size = dst_final_sz; in extend_sec()
1329 dst->shdr->sh_addralign = dst_align; in extend_sec()
1344 return sec->shdr->sh_type == SHT_PROGBITS || sec->shdr->sh_type == SHT_NOBITS; in is_data_sec()
1351 return sec->shdr->sh_type == SHT_REL; in is_relo_sec()
1410 int i, n = symtab->shdr->sh_size / symtab->shdr->sh_entsize, err; in linker_append_elf_syms()
1411 int str_sec_idx = symtab->shdr->sh_link; in linker_append_elf_syms()
2210 src_linked_sec = &obj->secs[src_sec->shdr->sh_info]; in linker_append_elf_relos()
2230 dst_sec->shdr->sh_link = linker->symtab_sec_idx; in linker_append_elf_relos()
2234 dst_sec->shdr->sh_info = dst_linked_sec->sec_idx; in linker_append_elf_relos()
2243 n = src_sec->shdr->sh_size / src_sec->shdr->sh_entsize; in linker_append_elf_relos()
2260 if (src_linked_sec->shdr->sh_flags & SHF_EXECINSTR) { in linker_append_elf_relos()
2292 int i, n = symtab->shdr->sh_size / symtab->shdr->sh_entsize; in find_sym_by_name()
2293 int str_sec_idx = symtab->shdr->sh_link; in find_sym_by_name()
2337 if (sec->shdr) in linker_fixup_btf()
2338 t->size = sec->shdr->sh_size; in linker_fixup_btf()
2774 sec->shdr->sh_size = strs_sz; in bpf_linker__finalize()
2823 Elf64_Shdr *shdr; in emit_elf_data_sec() local
2836 shdr = elf64_getshdr(scn); in emit_elf_data_sec()
2837 if (!shdr) in emit_elf_data_sec()
2840 shdr->sh_name = name_off; in emit_elf_data_sec()
2841 shdr->sh_type = SHT_PROGBITS; in emit_elf_data_sec()
2842 shdr->sh_flags = 0; in emit_elf_data_sec()
2843 shdr->sh_size = raw_sz; in emit_elf_data_sec()
2844 shdr->sh_link = 0; in emit_elf_data_sec()
2845 shdr->sh_info = 0; in emit_elf_data_sec()
2846 shdr->sh_addralign = align; in emit_elf_data_sec()
2847 shdr->sh_entsize = 0; in emit_elf_data_sec()