Lines Matching refs:dst_sec
106 struct dst_sec { struct
146 struct dst_sec *secs; argument
211 struct dst_sec *sec = &linker->secs[i]; in bpf_linker__free()
311 static struct dst_sec *add_dst_sec(struct bpf_linker *linker, const char *sec_name) in add_dst_sec()
313 struct dst_sec *secs = linker->secs, *sec; in add_dst_sec()
337 struct dst_sec *symtab = &linker->secs[linker->symtab_sec_idx]; in add_new_sym()
363 struct dst_sec *sec; in init_output_elf()
1140 static int init_sec(struct bpf_linker *linker, struct dst_sec *dst_sec, struct src_sec *src_sec) in init_sec() argument
1147 dst_sec->sec_sz = 0; in init_sec()
1148 dst_sec->sec_idx = 0; in init_sec()
1149 dst_sec->ephemeral = src_sec->ephemeral; in init_sec()
1165 dst_sec->scn = scn; in init_sec()
1166 dst_sec->shdr = shdr; in init_sec()
1167 dst_sec->data = data; in init_sec()
1168 dst_sec->sec_idx = elf_ndxscn(scn); in init_sec()
1196 static struct dst_sec *find_dst_sec_by_name(struct bpf_linker *linker, const char *sec_name) in find_dst_sec_by_name()
1198 struct dst_sec *sec; in find_dst_sec_by_name()
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()
1241 static bool is_exec_sec(struct dst_sec *sec) in is_exec_sec()
1259 static int extend_sec(struct bpf_linker *linker, struct dst_sec *dst, struct src_sec *src) in extend_sec()
1359 struct dst_sec *dst_sec; in linker_append_sec_data() local
1365 dst_sec = find_dst_sec_by_name(linker, src_sec->sec_name); in linker_append_sec_data()
1366 if (!dst_sec) { in linker_append_sec_data()
1367 dst_sec = add_dst_sec(linker, src_sec->sec_name); in linker_append_sec_data()
1368 if (!dst_sec) in linker_append_sec_data()
1370 err = init_sec(linker, dst_sec, src_sec); in linker_append_sec_data()
1376 if (!secs_match(dst_sec, src_sec)) { in linker_append_sec_data()
1384 if (!sec_content_is_same(dst_sec, src_sec)) { 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()
1440 struct dst_sec *symtab = &linker->secs[linker->symtab_sec_idx]; in get_sym_by_idx()
1999 struct dst_sec *dst_sec = NULL; in linker_append_elf_sym() local
2021 dst_sec = &linker->secs[src_sec->dst_id]; in linker_append_elf_sym()
2024 if (sym_type == STT_SECTION && dst_sec->sec_sym_idx) { in linker_append_elf_sym()
2025 obj->sym_map[src_sym_idx] = dst_sec->sec_sym_idx; in linker_append_elf_sym()
2060 dst_sec = &linker->secs[src_sec->dst_id]; in linker_append_elf_sym()
2131 dst_sym->st_shndx = dst_sec->sec_idx; in linker_append_elf_sym()
2136 glob_sym->sec_id = dst_sec->id; in linker_append_elf_sym()
2162 dst_sym->st_shndx = dst_sec ? dst_sec->sec_idx : sym->st_shndx; in linker_append_elf_sym()
2168 if (sym_type == STT_SECTION && dst_sec) { in linker_append_elf_sym()
2169 dst_sec->sec_sym_idx = dst_sym_idx; in linker_append_elf_sym()
2185 glob_sym->sec_id = dst_sec ? dst_sec->id : 0; in linker_append_elf_sym()
2203 struct dst_sec *dst_sec, *dst_linked_sec; in linker_append_elf_relos() local
2216 dst_sec = find_dst_sec_by_name(linker, src_sec->sec_name); in linker_append_elf_relos()
2217 if (!dst_sec) { in linker_append_elf_relos()
2218 dst_sec = add_dst_sec(linker, src_sec->sec_name); in linker_append_elf_relos()
2219 if (!dst_sec) in linker_append_elf_relos()
2221 err = init_sec(linker, dst_sec, src_sec); in linker_append_elf_relos()
2226 } else if (!secs_match(dst_sec, src_sec)) { 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()
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()
2244 dst_rel = dst_sec->raw_data + src_sec->dst_off; in linker_append_elf_relos()
2526 struct dst_sec *dst_sec; in linker_append_btf() local
2533 dst_sec = &linker->secs[src_sec->dst_id]; in linker_append_btf()
2543 dst_sec->has_btf = true; in linker_append_btf()
2549 void *sec_vars = dst_sec->sec_vars; in linker_append_btf()
2557 if (glob_sym->sec_id != dst_sec->id) { in linker_append_btf()
2559 name, glob_sym->sec_id, dst_sec->id); in linker_append_btf()
2576 dst_var = &dst_sec->sec_vars[glob_sym->var_idx]; in linker_append_btf()
2592 dst_sec->sec_var_cnt + 1, in linker_append_btf()
2593 sizeof(*dst_sec->sec_vars)); in linker_append_btf()
2597 dst_sec->sec_vars = sec_vars; in linker_append_btf()
2598 dst_sec->sec_var_cnt++; in linker_append_btf()
2600 dst_var = &dst_sec->sec_vars[dst_sec->sec_var_cnt - 1]; in linker_append_btf()
2606 glob_sym->var_idx = dst_sec->sec_var_cnt - 1; in linker_append_btf()
2635 struct dst_sec *dst_sec; in linker_append_btf_ext() local
2651 dst_sec = &linker->secs[src_sec->dst_id]; in linker_append_btf_ext()
2653 if (dst_sec->func_info.rec_sz == 0) in linker_append_btf_ext()
2654 dst_sec->func_info.rec_sz = rec_sz; in linker_append_btf_ext()
2655 if (dst_sec->func_info.rec_sz != rec_sz) { in linker_append_btf_ext()
2661 dst_rec = add_btf_ext_rec(&dst_sec->func_info, src_rec); in linker_append_btf_ext()
2680 dst_sec = &linker->secs[src_sec->dst_id]; in linker_append_btf_ext()
2682 if (dst_sec->line_info.rec_sz == 0) in linker_append_btf_ext()
2683 dst_sec->line_info.rec_sz = rec_sz; in linker_append_btf_ext()
2684 if (dst_sec->line_info.rec_sz != rec_sz) { in linker_append_btf_ext()
2690 dst_rec = add_btf_ext_rec(&dst_sec->line_info, src_rec); in linker_append_btf_ext()
2722 dst_sec = &linker->secs[src_sec->dst_id]; in linker_append_btf_ext()
2724 if (dst_sec->core_relo_info.rec_sz == 0) in linker_append_btf_ext()
2725 dst_sec->core_relo_info.rec_sz = rec_sz; in linker_append_btf_ext()
2726 if (dst_sec->core_relo_info.rec_sz != rec_sz) { in linker_append_btf_ext()
2732 dst_rec = add_btf_ext_rec(&dst_sec->core_relo_info, src_rec); in linker_append_btf_ext()
2754 struct dst_sec *sec; in bpf_linker__finalize()
2874 struct dst_sec *sec = &linker->secs[i]; in finalize_btf()
2981 struct dst_sec *sec = &linker->secs[i]; in finalize_btf_ext()
3059 struct dst_sec *sec = &linker->secs[i]; in finalize_btf_ext()
3076 struct dst_sec *sec = &linker->secs[i]; in finalize_btf_ext()
3093 struct dst_sec *sec = &linker->secs[i]; in finalize_btf_ext()