Lines Matching refs:sym
32 char *mod, *sym;
108 char *sym, *mod, *type;
111 sym = strchr(line, '\t');
112 if (!sym) {
113 ERROR("malformed Module.symvers (sym) at line %d", line_num);
117 *sym++ = '\0';
119 mod = strchr(sym, '\t');
135 if (*sym == '\0' || *mod == '\0') {
152 export->sym = strdup(sym);
153 if (!export->sym) {
158 hash_add(exports, &export->hash, str_hash(sym));
191 struct symbol *sym;
201 sym = reloc->sym;
203 if (is_sec_sym(sym)) {
204 ERROR("not sure how to handle section %s", sym->name);
208 if (is_func_sym(sym))
209 sym->csum.checksum = sym_checksum->checksum;
217 struct symbol *sym;
219 for_each_sym(elf, sym) {
220 if (is_file_sym(sym))
221 return sym;
227 static struct symbol *next_file_symbol(struct elf *elf, struct symbol *sym)
229 for_each_sym_continue(elf, sym) {
230 if (is_file_sym(sym))
231 return sym;
241 static bool is_uncorrelated_static_local(struct symbol *sym)
255 if (!is_object_sym(sym) || !is_local_sym(sym))
258 if (!strcmp(sym->sec->name, ".data.once"))
262 if (strstarts(sym->name, vars[i]))
272 static bool is_clang_tmp_label(struct symbol *sym)
274 return sym->type == STT_NOTYPE &&
275 is_text_sec(sym->sec) &&
276 strstarts(sym->name, ".Ltmp") &&
277 isdigit(sym->name[5]);
344 static bool dont_correlate(struct symbol *sym)
346 return is_file_sym(sym) ||
347 is_null_sym(sym) ||
348 is_sec_sym(sym) ||
349 is_prefix_func(sym) ||
350 is_uncorrelated_static_local(sym) ||
351 is_clang_tmp_label(sym) ||
352 is_string_sec(sym->sec) ||
353 is_special_section(sym->sec) ||
354 is_special_section_aux(sym->sec) ||
355 strstarts(sym->name, "__initcall__");
473 static unsigned long find_sympos(struct elf *elf, struct symbol *sym)
480 if (sym->bind != STB_LOCAL)
483 if (vmlinux && sym->type == STT_FUNC) {
493 !strcmp(s->name, sym->name)) {
495 if (s == sym)
503 !strcmp(s->name, sym->name)) {
505 if (s == sym)
513 if (!strcmp(s->name, sym->name)) {
515 if (s == sym)
524 ERROR("can't find sympos for %s", sym->name);
596 static const char *sym_type(struct symbol *sym)
598 switch (sym->type) {
608 static const char *sym_bind(struct symbol *sym)
610 switch (sym->bind) {
756 return section_reference_needed(reloc->sym->sec) == is_sec_sym(reloc->sym);
759 static struct export *find_export(struct symbol *sym)
763 hash_for_each_possible(exports, export, hash, str_hash(sym->name)) {
764 if (!strcmp(export->sym, sym->name))
828 struct symbol *patched_sym = patched_reloc->sym;
869 struct symbol *sym = reloc->sym;
870 struct section *sec = sym->sec;
872 if (!sec->sym && !elf_create_section_symbol(elf, sec))
875 reloc->sym = sec->sym;
876 set_reloc_sym(elf, reloc, sym->idx);
877 set_reloc_addend(elf, reloc, sym->offset + reloc_addend(reloc));
883 struct symbol *sym = reloc->sym;
884 struct section *sec = sym->sec;
887 sym = find_symbol_by_offset(sec, 0);
888 if (sym && sym->len == sec_size(sec))
892 sym = find_symbol_containing(sec, arch_adjusted_addend(reloc));
893 if (!sym) {
902 reloc->sym = sym;
903 set_reloc_sym(elf, reloc, sym->idx);
904 set_reloc_addend(elf, reloc, reloc_addend(reloc) - sym->offset);
917 if (section_reference_needed(reloc->sym->sec))
930 struct symbol *patched_sym = patched_reloc->sym;
934 struct symbol *sym, *klp_sym;
953 sym = patched_sym->clone;
954 if (!sym) {
956 sym = elf_create_symbol(e->out, patched_sym->name, NULL,
958 if (!sym)
961 patched_sym->clone = sym;
962 sym->clone = patched_sym;
965 if (!elf_create_reloc(e->out, sec, offset, sym, addend, reloc_type(patched_reloc)))
974 sym_orig_name = export->sym;
987 /* symbol format: .klp.sym.modname.sym_name,sympos */
1027 if (!sec->sym && !elf_create_section_symbol(e->out, sec))
1032 sec->sym, offset, R_ABS64))
1035 /* klp_reloc.sym */
1037 klp_reloc_off + offsetof(struct klp_reloc, sym),
1059 struct symbol *patched_sym = patched_reloc->sym;
1163 if (patched_reloc->sym->sec &&
1164 !strcmp(patched_reloc->sym->sec->name, ".altinstr_aux"))
1169 "failed to convert reloc sym '%s' to its proper format",
1170 patched_reloc->sym->name);
1264 next_reloc->sym->sec != reloc->sym->sec)
1272 size = sec_size(reloc->sym->sec) - offset;
1274 if (create_fake_symbol(elf, reloc->sym->sec, offset, size))
1313 static bool should_keep_special_sym(struct elf *elf, struct symbol *sym)
1317 if (is_sec_sym(sym) || !sym->sec->rsec)
1320 sym_for_each_reloc(elf, sym, reloc) {
1324 if (is_func_sym(reloc->sym) && reloc->sym->included)
1351 static int validate_special_section_klp_reloc(struct elfs *e, struct symbol *sym)
1353 bool static_branch = !strcmp(sym->sec->name, "__jump_table");
1354 bool static_call = !strcmp(sym->sec->name, ".static_call_sites");
1363 sym_for_each_reloc(e->patched, sym, reloc) {
1371 if (reloc->sym->type != STT_OBJECT) {
1374 if (reloc->sym->type == STT_FUNC && !code_sym) {
1375 code_sym = reloc->sym->name;
1385 export = find_export(reloc->sym);
1402 if (strstarts(reloc->sym->name, "__tracepoint_")) {
1404 code_sym, reloc->sym->name + 13);
1409 if (strstr(reloc->sym->name, "__UNIQUE_ID_ddebug_")) {
1417 code_sym, code_offset, reloc->sym->name);
1422 if (strstarts(reloc->sym->name, "__SCK__tp_func_")) {
1428 code_sym, code_offset, reloc->sym->name);
1490 struct symbol *funcs_sym, *str_sym, *sym;
1548 for_each_sym(e->out, sym) {
1553 if (!is_func_sym(sym) || sym->cold || !sym->clone || !sym->clone->changed)
1562 addend = elf_add_string(e->out, str_sec, sym->clone->twin->name);
1574 sym, 0, R_ABS64))
1579 sympos = find_sympos(e->orig, sym->clone->twin);
1601 sym = find_symbol_by_name(e->out, sym_name);
1602 if (sym) {
1605 reloc = find_reloc_by_dest(e->out, sym->sec, sym->offset);
1610 reloc->sym, reloc_addend(reloc), R_ABS64))
1617 sym = find_symbol_by_name(e->out, sym_name);
1618 if (sym) {
1621 reloc = find_reloc_by_dest(e->out, sym->sec, sym->offset);
1626 reloc->sym, reloc_addend(reloc), R_ABS64))
1633 sym = find_symbol_by_name(e->out, sym_name);
1634 if (sym) {
1637 reloc = find_reloc_by_dest(e->out, sym->sec, sym->offset);
1642 reloc->sym, reloc_addend(reloc), R_ABS64))
1649 sym = find_symbol_by_name(e->out, sym_name);
1650 if (sym) {
1653 reloc = find_reloc_by_dest(e->out, sym->sec, sym->offset);
1658 reloc->sym, reloc_addend(reloc), R_ABS64))