Lines Matching refs:src_sec
26 struct src_sec { struct
62 struct src_sec *secs; argument
164 static int linker_sanity_check_elf_symtab(struct src_obj *obj, struct src_sec *sec);
165 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()
702 struct src_sec *sec; in linker_sanity_check_elf()
763 static int linker_sanity_check_elf_symtab(struct src_obj *obj, struct src_sec *sec) in linker_sanity_check_elf_symtab()
765 struct src_sec *link_sec; in linker_sanity_check_elf_symtab()
837 static int linker_sanity_check_elf_relos(struct src_obj *obj, struct src_sec *sec) in linker_sanity_check_elf_relos()
839 struct src_sec *link_sec, *sym_sec; in linker_sanity_check_elf_relos()
978 static int init_sec(struct bpf_linker *linker, struct dst_sec *dst_sec, struct src_sec *src_sec) in init_sec() argument
987 dst_sec->ephemeral = src_sec->ephemeral; in init_sec()
990 if (src_sec->ephemeral) in init_sec()
1008 name_off = strset__add_str(linker->strtab_strs, src_sec->sec_name); in init_sec()
1013 shdr->sh_type = src_sec->shdr->sh_type; in init_sec()
1014 shdr->sh_flags = src_sec->shdr->sh_flags; in init_sec()
1022 shdr->sh_addralign = src_sec->shdr->sh_addralign; in init_sec()
1023 shdr->sh_entsize = src_sec->shdr->sh_entsize; in init_sec()
1025 data->d_type = src_sec->data->d_type; in init_sec()
1028 data->d_align = src_sec->data->d_align; in init_sec()
1049 static bool secs_match(struct dst_sec *dst, struct src_sec *src) in secs_match()
1070 static bool sec_content_is_same(struct dst_sec *dst_sec, struct src_sec *src_sec) in sec_content_is_same() argument
1072 if (dst_sec->sec_sz != src_sec->shdr->sh_size) in sec_content_is_same()
1074 if (memcmp(dst_sec->raw_data, src_sec->data->d_buf, dst_sec->sec_sz) != 0) in sec_content_is_same()
1079 static int extend_sec(struct bpf_linker *linker, struct dst_sec *dst, struct src_sec *src) in extend_sec()
1140 static bool is_data_sec(struct src_sec *sec) in is_data_sec()
1150 static bool is_relo_sec(struct src_sec *sec) in is_relo_sec()
1162 struct src_sec *src_sec; in linker_append_sec_data() local
1165 src_sec = &obj->secs[i]; in linker_append_sec_data()
1166 if (!is_data_sec(src_sec)) in linker_append_sec_data()
1169 dst_sec = find_dst_sec_by_name(linker, src_sec->sec_name); in linker_append_sec_data()
1171 dst_sec = add_dst_sec(linker, src_sec->sec_name); in linker_append_sec_data()
1174 err = init_sec(linker, dst_sec, src_sec); in linker_append_sec_data()
1176 pr_warn("failed to init section '%s'\n", src_sec->sec_name); in linker_append_sec_data()
1180 if (!secs_match(dst_sec, src_sec)) { in linker_append_sec_data()
1181 pr_warn("ELF sections %s are incompatible\n", src_sec->sec_name); in linker_append_sec_data()
1186 if (strcmp(src_sec->sec_name, "license") == 0 in linker_append_sec_data()
1187 || strcmp(src_sec->sec_name, "version") == 0) { in linker_append_sec_data()
1188 if (!sec_content_is_same(dst_sec, src_sec)) { in linker_append_sec_data()
1189 pr_warn("non-identical contents of section '%s' are not supported\n", src_sec->sec_name); in linker_append_sec_data()
1192 src_sec->skipped = true; in linker_append_sec_data()
1193 src_sec->dst_id = dst_sec->id; in linker_append_sec_data()
1199 src_sec->dst_id = dst_sec->id; in linker_append_sec_data()
1201 err = extend_sec(linker, dst_sec, src_sec); in linker_append_sec_data()
1211 struct src_sec *symtab = &obj->secs[obj->symtab_sec_idx]; in linker_append_elf_syms()
1715 static struct src_sec *find_src_sec_by_name(struct src_obj *obj, const char *sec_name) in find_src_sec_by_name()
1717 struct src_sec *sec; in find_src_sec_by_name()
1802 struct src_sec *src_sec = NULL; in linker_append_elf_sym() local
1822 src_sec = &obj->secs[sym->st_shndx]; in linker_append_elf_sym()
1823 if (src_sec->skipped) in linker_append_elf_sym()
1825 dst_sec = &linker->secs[src_sec->dst_id]; in linker_append_elf_sym()
1856 src_sec = find_src_sec_by_name(obj, sec_name); in linker_append_elf_sym()
1857 if (!src_sec) { in linker_append_elf_sym()
1861 dst_sec = &linker->secs[src_sec->dst_id]; in linker_append_elf_sym()
1933 dst_sym->st_value = src_sec->dst_off + sym->st_value; in linker_append_elf_sym()
1964 dst_sym->st_value = (src_sec ? src_sec->dst_off : 0) + sym->st_value; in linker_append_elf_sym()
1999 struct src_sec *src_symtab = &obj->secs[obj->symtab_sec_idx]; in linker_append_elf_relos()
2004 struct src_sec *src_sec, *src_linked_sec; in linker_append_elf_relos() local
2009 src_sec = &obj->secs[i]; in linker_append_elf_relos()
2010 if (!is_relo_sec(src_sec)) in linker_append_elf_relos()
2014 src_linked_sec = &obj->secs[src_sec->shdr->sh_info]; in linker_append_elf_relos()
2018 dst_sec = find_dst_sec_by_name(linker, src_sec->sec_name); in linker_append_elf_relos()
2020 dst_sec = add_dst_sec(linker, src_sec->sec_name); in linker_append_elf_relos()
2023 err = init_sec(linker, dst_sec, src_sec); in linker_append_elf_relos()
2025 pr_warn("failed to init section '%s'\n", src_sec->sec_name); in linker_append_elf_relos()
2028 } else if (!secs_match(dst_sec, src_sec)) { in linker_append_elf_relos()
2029 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()