Lines Matching refs:src_sec
27 struct src_sec { struct
63 struct src_sec *secs; argument
165 static int linker_sanity_check_elf_symtab(struct src_obj *obj, struct src_sec *sec);
166 static int linker_sanity_check_elf_relos(struct src_obj *obj, struct src_sec *sec);
479 static bool is_ignored_sec(struct src_sec *sec) in is_ignored_sec()
516 static struct src_sec *add_src_sec(struct src_obj *obj, const char *sec_name) in add_src_sec()
518 struct src_sec *secs = obj->secs, *sec; in add_src_sec()
554 struct src_sec *sec; in linker_load_obj_file()
707 struct src_sec *sec; in linker_sanity_check_elf()
768 static int linker_sanity_check_elf_symtab(struct src_obj *obj, struct src_sec *sec) in linker_sanity_check_elf_symtab()
770 struct src_sec *link_sec; in linker_sanity_check_elf_symtab()
842 static int linker_sanity_check_elf_relos(struct src_obj *obj, struct src_sec *sec) in linker_sanity_check_elf_relos()
844 struct src_sec *link_sec, *sym_sec; in linker_sanity_check_elf_relos()
983 static int init_sec(struct bpf_linker *linker, struct dst_sec *dst_sec, struct src_sec *src_sec) in init_sec() argument
992 dst_sec->ephemeral = src_sec->ephemeral; in init_sec()
995 if (src_sec->ephemeral) in init_sec()
1013 name_off = strset__add_str(linker->strtab_strs, src_sec->sec_name); in init_sec()
1018 shdr->sh_type = src_sec->shdr->sh_type; in init_sec()
1019 shdr->sh_flags = src_sec->shdr->sh_flags; in init_sec()
1027 shdr->sh_addralign = src_sec->shdr->sh_addralign; in init_sec()
1028 shdr->sh_entsize = src_sec->shdr->sh_entsize; in init_sec()
1030 data->d_type = src_sec->data->d_type; in init_sec()
1033 data->d_align = src_sec->data->d_align; in init_sec()
1054 static bool secs_match(struct dst_sec *dst, struct src_sec *src) in secs_match()
1075 static bool sec_content_is_same(struct dst_sec *dst_sec, struct src_sec *src_sec) in sec_content_is_same() argument
1077 if (dst_sec->sec_sz != src_sec->shdr->sh_size) in sec_content_is_same()
1079 if (memcmp(dst_sec->raw_data, src_sec->data->d_buf, dst_sec->sec_sz) != 0) in sec_content_is_same()
1084 static int extend_sec(struct bpf_linker *linker, struct dst_sec *dst, struct src_sec *src) in extend_sec()
1145 static bool is_data_sec(struct src_sec *sec) in is_data_sec()
1155 static bool is_relo_sec(struct src_sec *sec) in is_relo_sec()
1167 struct src_sec *src_sec; in linker_append_sec_data() local
1170 src_sec = &obj->secs[i]; in linker_append_sec_data()
1171 if (!is_data_sec(src_sec)) in linker_append_sec_data()
1174 dst_sec = find_dst_sec_by_name(linker, src_sec->sec_name); in linker_append_sec_data()
1176 dst_sec = add_dst_sec(linker, src_sec->sec_name); in linker_append_sec_data()
1179 err = init_sec(linker, dst_sec, src_sec); in linker_append_sec_data()
1181 pr_warn("failed to init section '%s'\n", src_sec->sec_name); in linker_append_sec_data()
1185 if (!secs_match(dst_sec, src_sec)) { in linker_append_sec_data()
1186 pr_warn("ELF sections %s are incompatible\n", src_sec->sec_name); in linker_append_sec_data()
1191 if (strcmp(src_sec->sec_name, "license") == 0 in linker_append_sec_data()
1192 || strcmp(src_sec->sec_name, "version") == 0) { in linker_append_sec_data()
1193 if (!sec_content_is_same(dst_sec, src_sec)) { in linker_append_sec_data()
1194 pr_warn("non-identical contents of section '%s' are not supported\n", src_sec->sec_name); in linker_append_sec_data()
1197 src_sec->skipped = true; in linker_append_sec_data()
1198 src_sec->dst_id = dst_sec->id; in linker_append_sec_data()
1204 src_sec->dst_id = dst_sec->id; in linker_append_sec_data()
1206 err = extend_sec(linker, dst_sec, src_sec); in linker_append_sec_data()
1216 struct src_sec *symtab = &obj->secs[obj->symtab_sec_idx]; in linker_append_elf_syms()
1718 static struct src_sec *find_src_sec_by_name(struct src_obj *obj, const char *sec_name) in find_src_sec_by_name()
1720 struct src_sec *sec; in find_src_sec_by_name()
1805 struct src_sec *src_sec = NULL; in linker_append_elf_sym() local
1825 src_sec = &obj->secs[sym->st_shndx]; in linker_append_elf_sym()
1826 if (src_sec->skipped) in linker_append_elf_sym()
1828 dst_sec = &linker->secs[src_sec->dst_id]; in linker_append_elf_sym()
1859 src_sec = find_src_sec_by_name(obj, sec_name); in linker_append_elf_sym()
1860 if (!src_sec) { in linker_append_elf_sym()
1864 dst_sec = &linker->secs[src_sec->dst_id]; in linker_append_elf_sym()
1936 dst_sym->st_value = src_sec->dst_off + sym->st_value; in linker_append_elf_sym()
1967 dst_sym->st_value = (src_sec ? src_sec->dst_off : 0) + sym->st_value; in linker_append_elf_sym()
2002 struct src_sec *src_symtab = &obj->secs[obj->symtab_sec_idx]; in linker_append_elf_relos()
2007 struct src_sec *src_sec, *src_linked_sec; in linker_append_elf_relos() local
2012 src_sec = &obj->secs[i]; in linker_append_elf_relos()
2013 if (!is_relo_sec(src_sec)) in linker_append_elf_relos()
2017 src_linked_sec = &obj->secs[src_sec->shdr->sh_info]; in linker_append_elf_relos()
2021 dst_sec = find_dst_sec_by_name(linker, src_sec->sec_name); in linker_append_elf_relos()
2023 dst_sec = add_dst_sec(linker, src_sec->sec_name); in linker_append_elf_relos()
2026 err = init_sec(linker, dst_sec, src_sec); in linker_append_elf_relos()
2028 pr_warn("failed to init section '%s'\n", src_sec->sec_name); in linker_append_elf_relos()
2031 } else if (!secs_match(dst_sec, src_sec)) { in linker_append_elf_relos()
2032 pr_warn("sections %s are not compatible\n", src_sec->sec_name); in linker_append_elf_relos()
2043 src_sec->dst_id = dst_sec->id; in linker_append_elf_relos()
2044 err = extend_sec(linker, dst_sec, src_sec); in linker_append_elf_relos()
2048 src_rel = src_sec->data->d_buf; in linker_append_elf_relos()
2049 dst_rel = dst_sec->raw_data + src_sec->dst_off; in linker_append_elf_relos()
2050 n = src_sec->shdr->sh_size / src_sec->shdr->sh_entsize; in linker_append_elf_relos()
2067 struct src_sec *sec = &obj->secs[src_sym->st_shndx]; in linker_append_elf_relos()
2100 struct src_sec *symtab = &obj->secs[obj->symtab_sec_idx]; in find_sym_by_name()
2128 struct src_sec *sec; in linker_fixup_btf()
2326 struct src_sec *src_sec; in linker_append_btf() local
2331 src_sec = &obj->secs[i]; in linker_append_btf()
2332 if (!src_sec->sec_type_id || src_sec->skipped) in linker_append_btf()
2334 dst_sec = &linker->secs[src_sec->dst_id]; in linker_append_btf()
2346 t = btf__type_by_id(obj->btf, src_sec->sec_type_id); in linker_append_btf()
2400 dst_var->offset = src_sec->dst_off + src_var->offset; in linker_append_btf()
2431 struct src_sec *src_sec; in linker_append_btf_ext() local
2443 src_sec = find_src_sec_by_name(obj, sec_name); in linker_append_btf_ext()
2444 if (!src_sec) { in linker_append_btf_ext()
2448 dst_sec = &linker->secs[src_sec->dst_id]; in linker_append_btf_ext()
2462 dst_rec->insn_off += src_sec->dst_off; in linker_append_btf_ext()
2472 src_sec = find_src_sec_by_name(obj, sec_name); in linker_append_btf_ext()
2473 if (!src_sec) { in linker_append_btf_ext()
2477 dst_sec = &linker->secs[src_sec->dst_id]; in linker_append_btf_ext()
2491 dst_rec->insn_off += src_sec->dst_off; in linker_append_btf_ext()
2514 src_sec = find_src_sec_by_name(obj, sec_name); in linker_append_btf_ext()
2515 if (!src_sec) { in linker_append_btf_ext()
2519 dst_sec = &linker->secs[src_sec->dst_id]; in linker_append_btf_ext()
2533 dst_rec->insn_off += src_sec->dst_off; in linker_append_btf_ext()