Lines Matching refs:src_sec

31 struct src_sec {  struct
67 struct src_sec *secs; argument
174 static int linker_sanity_check_elf_symtab(struct src_obj *obj, struct src_sec *sec);
175 static int linker_sanity_check_elf_relos(struct src_obj *obj, struct src_sec *sec);
605 static bool is_ignored_sec(struct src_sec *sec) in is_ignored_sec()
642 static struct src_sec *add_src_sec(struct src_obj *obj, const char *sec_name) in add_src_sec()
644 struct src_sec *secs = obj->secs, *sec; in add_src_sec()
672 struct src_sec *sec; in linker_load_obj_file()
831 struct src_sec *sec; in linker_sanity_check_elf()
911 static int linker_sanity_check_elf_symtab(struct src_obj *obj, struct src_sec *sec) in linker_sanity_check_elf_symtab()
913 struct src_sec *link_sec; in linker_sanity_check_elf_symtab()
985 static int linker_sanity_check_elf_relos(struct src_obj *obj, struct src_sec *sec) in linker_sanity_check_elf_relos()
987 struct src_sec *link_sec, *sym_sec; in linker_sanity_check_elf_relos()
1140 static int init_sec(struct bpf_linker *linker, struct dst_sec *dst_sec, struct src_sec *src_sec) in init_sec() argument
1149 dst_sec->ephemeral = src_sec->ephemeral; in init_sec()
1152 if (src_sec->ephemeral) in init_sec()
1170 name_off = strset__add_str(linker->strtab_strs, src_sec->sec_name); 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()
1184 shdr->sh_addralign = src_sec->shdr->sh_addralign; in init_sec()
1185 shdr->sh_entsize = src_sec->shdr->sh_entsize; in init_sec()
1187 data->d_type = src_sec->data->d_type; in init_sec()
1190 data->d_align = src_sec->data->d_align; in init_sec()
1211 static bool secs_match(struct dst_sec *dst, struct src_sec *src) in secs_match()
1232 static bool sec_content_is_same(struct dst_sec *dst_sec, struct src_sec *src_sec) in sec_content_is_same() argument
1234 if (dst_sec->sec_sz != src_sec->shdr->sh_size) in sec_content_is_same()
1236 if (memcmp(dst_sec->raw_data, src_sec->data->d_buf, dst_sec->sec_sz) != 0) in sec_content_is_same()
1259 static int extend_sec(struct bpf_linker *linker, struct dst_sec *dst, struct src_sec *src) in extend_sec()
1336 static bool is_data_sec(struct src_sec *sec) in is_data_sec()
1346 static bool is_relo_sec(struct src_sec *sec) in is_relo_sec()
1358 struct src_sec *src_sec; in linker_append_sec_data() local
1361 src_sec = &obj->secs[i]; in linker_append_sec_data()
1362 if (!is_data_sec(src_sec)) in linker_append_sec_data()
1365 dst_sec = find_dst_sec_by_name(linker, src_sec->sec_name); in linker_append_sec_data()
1367 dst_sec = add_dst_sec(linker, src_sec->sec_name); in linker_append_sec_data()
1370 err = init_sec(linker, dst_sec, src_sec); in linker_append_sec_data()
1372 pr_warn("failed to init section '%s'\n", src_sec->sec_name); in linker_append_sec_data()
1376 if (!secs_match(dst_sec, src_sec)) { in linker_append_sec_data()
1377 pr_warn("ELF sections %s are incompatible\n", src_sec->sec_name); in linker_append_sec_data()
1382 if (strcmp(src_sec->sec_name, "license") == 0 in linker_append_sec_data()
1383 || strcmp(src_sec->sec_name, "version") == 0) { in linker_append_sec_data()
1384 if (!sec_content_is_same(dst_sec, src_sec)) { in linker_append_sec_data()
1385 pr_warn("non-identical contents of section '%s' are not supported\n", src_sec->sec_name); in linker_append_sec_data()
1388 src_sec->skipped = true; in linker_append_sec_data()
1389 src_sec->dst_id = dst_sec->id; in linker_append_sec_data()
1395 src_sec->dst_id = dst_sec->id; in linker_append_sec_data()
1397 err = extend_sec(linker, dst_sec, src_sec); in linker_append_sec_data()
1407 struct src_sec *symtab = &obj->secs[obj->symtab_sec_idx]; in linker_append_elf_syms()
1911 static struct src_sec *find_src_sec_by_name(struct src_obj *obj, const char *sec_name) in find_src_sec_by_name()
1913 struct src_sec *sec; in find_src_sec_by_name()
1998 struct src_sec *src_sec = NULL; in linker_append_elf_sym() local
2018 src_sec = &obj->secs[sym->st_shndx]; in linker_append_elf_sym()
2019 if (src_sec->skipped) in linker_append_elf_sym()
2021 dst_sec = &linker->secs[src_sec->dst_id]; in linker_append_elf_sym()
2029 if (strcmp(src_sec->sec_name, JUMPTABLES_SEC) == 0) in linker_append_elf_sym()
2055 src_sec = find_src_sec_by_name(obj, sec_name); in linker_append_elf_sym()
2056 if (!src_sec) { in linker_append_elf_sym()
2060 dst_sec = &linker->secs[src_sec->dst_id]; in linker_append_elf_sym()
2132 dst_sym->st_value = src_sec->dst_off + sym->st_value; in linker_append_elf_sym()
2163 dst_sym->st_value = (src_sec ? src_sec->dst_off : 0) + sym->st_value; in linker_append_elf_sym()
2198 struct src_sec *src_symtab = &obj->secs[obj->symtab_sec_idx]; in linker_append_elf_relos()
2202 struct src_sec *src_sec, *src_linked_sec; in linker_append_elf_relos() local
2207 src_sec = &obj->secs[i]; in linker_append_elf_relos()
2208 if (!is_relo_sec(src_sec)) in linker_append_elf_relos()
2212 src_linked_sec = &obj->secs[src_sec->shdr->sh_info]; in linker_append_elf_relos()
2216 dst_sec = find_dst_sec_by_name(linker, src_sec->sec_name); in linker_append_elf_relos()
2218 dst_sec = add_dst_sec(linker, src_sec->sec_name); in linker_append_elf_relos()
2221 err = init_sec(linker, dst_sec, src_sec); in linker_append_elf_relos()
2223 pr_warn("failed to init section '%s'\n", src_sec->sec_name); in linker_append_elf_relos()
2226 } else if (!secs_match(dst_sec, src_sec)) { in linker_append_elf_relos()
2227 pr_warn("sections %s are not compatible\n", src_sec->sec_name); in linker_append_elf_relos()
2238 src_sec->dst_id = dst_sec->id; in linker_append_elf_relos()
2239 err = extend_sec(linker, dst_sec, src_sec); in linker_append_elf_relos()
2243 src_rel = src_sec->data->d_buf; in linker_append_elf_relos()
2244 dst_rel = dst_sec->raw_data + src_sec->dst_off; in linker_append_elf_relos()
2245 n = src_sec->shdr->sh_size / src_sec->shdr->sh_entsize; in linker_append_elf_relos()
2259 struct src_sec *sec = &obj->secs[src_sym->st_shndx]; in linker_append_elf_relos()
2292 struct src_sec *symtab = &obj->secs[obj->symtab_sec_idx]; in find_sym_by_name()
2320 struct src_sec *sec; in linker_fixup_btf()
2525 struct src_sec *src_sec; in linker_append_btf() local
2530 src_sec = &obj->secs[i]; in linker_append_btf()
2531 if (!src_sec->sec_type_id || src_sec->skipped) in linker_append_btf()
2533 dst_sec = &linker->secs[src_sec->dst_id]; in linker_append_btf()
2545 t = btf__type_by_id(obj->btf, src_sec->sec_type_id); in linker_append_btf()
2603 dst_var->offset = src_sec->dst_off + src_var->offset; in linker_append_btf()
2634 struct src_sec *src_sec; in linker_append_btf_ext() local
2646 src_sec = find_src_sec_by_name(obj, sec_name); in linker_append_btf_ext()
2647 if (!src_sec) { in linker_append_btf_ext()
2651 dst_sec = &linker->secs[src_sec->dst_id]; in linker_append_btf_ext()
2665 dst_rec->insn_off += src_sec->dst_off; in linker_append_btf_ext()
2675 src_sec = find_src_sec_by_name(obj, sec_name); in linker_append_btf_ext()
2676 if (!src_sec) { in linker_append_btf_ext()
2680 dst_sec = &linker->secs[src_sec->dst_id]; in linker_append_btf_ext()
2694 dst_rec->insn_off += src_sec->dst_off; in linker_append_btf_ext()
2717 src_sec = find_src_sec_by_name(obj, sec_name); in linker_append_btf_ext()
2718 if (!src_sec) { in linker_append_btf_ext()
2722 dst_sec = &linker->secs[src_sec->dst_id]; in linker_append_btf_ext()
2736 dst_rec->insn_off += src_sec->dst_off; in linker_append_btf_ext()