Lines Matching refs:sec

38 			      struct section *sec, unsigned long offset)
42 hash_for_each_possible(file->insn_hash, insn, hash, sec_offset_hash(sec, offset)) {
43 if (insn->sec == sec && insn->offset == offset)
54 return find_insn(file, insn->sec, insn->offset + insn->len);
80 return find_insn(file, func->cfunc->sec, func->cfunc->offset);
88 return find_insn(file, insn->sec, insn->offset - insn->prev_len);
113 for (insn = find_insn(file, func->sec, func->offset); \
118 for (insn = find_insn(file, sym->sec, sym->offset); \
215 insn = find_insn(file, func->sec, func->offset);
278 struct section *sec)
285 * not correctly determine insn_call_dest(insn)->sec (external symbols
288 if (opts.link && opts.noinstr && sec)
289 state->noinstr = sec->noinstr;
370 struct section *sec;
376 for_each_sec(file, sec) {
381 if (!(sec->sh.sh_flags & SHF_EXECINSTR))
384 if (strcmp(sec->name, ".altinstr_replacement") &&
385 strcmp(sec->name, ".altinstr_aux") &&
386 strncmp(sec->name, ".discard.", 9))
387 sec->text = true;
389 if (!strcmp(sec->name, ".noinstr.text") ||
390 !strcmp(sec->name, ".entry.text") ||
391 !strcmp(sec->name, ".cpuidle.text") ||
392 !strncmp(sec->name, ".text..__x86.", 13))
393 sec->noinstr = true;
401 if (!strcmp(sec->name, ".init.text") && !opts.module)
402 sec->init = true;
404 for (offset = 0; offset < sec->sh.sh_size; offset += insn->len) {
419 insn->sec = sec;
423 ret = arch_decode_instruction(file, sec, offset,
424 sec->sh.sh_size - offset,
439 hash_add(file->insn_hash, &insn->hash, sec_offset_hash(sec, insn->offset));
443 // printf("%s: last chunk used: %d\n", sec->name, (int)idx);
445 sec_for_each_sym(sec, func) {
449 if (func->offset == sec->sh.sh_size) {
461 if (!find_insn(file, sec, func->offset)) {
506 reloc = find_reloc_by_dest_range(file->elf, sym->sec, off, end - off);
512 func = find_symbol_by_offset(reloc->sym->sec,
567 struct section *sec)
571 unsigned int end = (sec->sh.sh_size > 10) ? sec->sh.sh_size - 10 : 0;
573 for (offset = sec->sh.sh_size - 1; offset >= end && !insn; offset--)
574 insn = find_insn(file, sec, offset);
605 insn = find_insn(file, reloc->sym->sec, addend);
608 else if (addend == reloc->sym->sec->sh.sh_size) {
609 insn = find_last_insn(file, reloc->sym->sec);
612 reloc->sym->sec->name, addend);
617 reloc->sym->sec->name, addend);
644 insn = find_insn(file, reloc->sym->sec, addend);
647 else if (addend == reloc->sym->sec->sh.sh_size) {
648 insn = find_last_insn(file, reloc->sym->sec);
651 reloc->sym->sec->name, addend);
656 reloc->sym->sec->name, addend);
669 struct section *sec;
675 sec = find_section_by_name(file->elf, ".static_call_sites");
676 if (sec) {
689 sec = elf_create_section_pair(file->elf, ".static_call_sites",
691 if (!sec)
695 sec->sh.sh_flags |= SHF_WRITE;
701 if (!elf_init_reloc_text_sym(file->elf, sec,
703 insn->sec, insn->offset))
743 if (!elf_init_reloc_data_sym(file->elf, sec,
758 struct section *sec;
761 sec = find_section_by_name(file->elf, ".retpoline_sites");
762 if (sec) {
774 sec = elf_create_section_pair(file->elf, ".retpoline_sites",
776 if (!sec)
782 if (!elf_init_reloc_text_sym(file->elf, sec,
784 insn->sec, insn->offset))
796 struct section *sec;
799 sec = find_section_by_name(file->elf, ".return_sites");
800 if (sec) {
812 sec = elf_create_section_pair(file->elf, ".return_sites",
814 if (!sec)
820 if (!elf_init_reloc_text_sym(file->elf, sec,
822 insn->sec, insn->offset))
834 struct section *sec;
837 sec = find_section_by_name(file->elf, ".ibt_endbr_seal");
838 if (sec) {
856 sec = elf_create_section_pair(file->elf, ".ibt_endbr_seal",
858 if (!sec)
864 int *site = (int *)sec->data->d_buf + idx;
874 if (!elf_init_reloc_text_sym(file->elf, sec,
876 insn->sec, insn->offset))
887 struct section *sec;
891 sec = find_section_by_name(file->elf, ".cfi_sites");
892 if (sec) {
909 sec = elf_create_section_pair(file->elf, ".cfi_sites",
911 if (!sec)
922 if (!elf_init_reloc_text_sym(file->elf, sec,
924 sym->sec, sym->offset))
937 struct section *sec;
940 sec = find_section_by_name(file->elf, "__mcount_loc");
941 if (sec) {
954 sec = elf_create_section_pair(file->elf, "__mcount_loc", addr_size,
956 if (!sec)
959 sec->sh.sh_addralign = addr_size;
966 reloc = elf_init_reloc_text_sym(file->elf, sec, idx * addr_size, idx,
967 insn->sec, insn->offset);
982 struct section *sec;
985 sec = find_section_by_name(file->elf, ".call_sites");
986 if (sec) {
999 sec = elf_create_section_pair(file->elf, ".call_sites",
1001 if (!sec)
1007 if (!elf_init_reloc_text_sym(file->elf, sec,
1009 insn->sec, insn->offset))
1039 func = find_func_by_offset(reloc->sym->sec, reloc_addend(reloc));
1279 insn = find_insn(file, reloc->sym->sec, reloc_addend(reloc));
1328 reloc = find_reloc_by_dest_range(file->elf, insn->sec,
1364 if (!strcmp(insn->sec->name, ".altinstr_replacement"))
1382 if (opts.hack_noinstr && insn->sec->noinstr && sym->profiling_func) {
1386 elf_write_insn(file->elf, insn->sec,
1413 elf_write_insn(file->elf, insn->sec,
1424 if (insn->type == INSN_CALL && !insn->sec->init)
1564 dest_sec = insn->sec;
1567 dest_sec = reloc->sym->sec;
1582 } else if (reloc->sym->sec->idx) {
1583 dest_sec = reloc->sym->sec;
1656 static struct symbol *find_call_destination(struct section *sec, unsigned long offset)
1660 call_dest = find_func_by_offset(sec, offset);
1662 call_dest = find_symbol_by_offset(sec, offset);
1684 dest = find_call_destination(insn->sec, dest_off);
1703 dest = find_call_destination(reloc->sym->sec, dest_off);
1706 reloc->sym->sec->name, dest_off);
1796 nop->sec = special_alt->new_sec;
1892 elf_write_insn(file->elf, orig_insn->sec,
2016 for_each_reloc_from(table->sec, reloc) {
2027 if (reloc->sym->sec == pfunc->sec &&
2031 dest_insn = find_insn(file, reloc->sym->sec, reloc_addend(reloc));
2092 dest_insn = find_insn(file, table_reloc->sym->sec, reloc_addend(table_reloc));
2207 struct section *sec;
2213 sec = find_section_by_name(file->elf, ".discard.unwind_hints");
2214 if (!sec)
2217 if (!sec->rsec) {
2222 if (sec->sh.sh_size % sizeof(struct unwind_hint)) {
2229 for (i = 0; i < sec->sh.sh_size / sizeof(struct unwind_hint); i++) {
2230 hint = (struct unwind_hint *)sec->data->d_buf + i;
2232 reloc = find_reloc_by_dest(file->elf, sec, i * sizeof(*hint));
2238 insn = find_insn(file, reloc->sym->sec, reloc_addend(reloc));
2263 struct symbol *sym = find_symbol_by_offset(insn->sec, insn->offset);
2306 insn = find_insn(file, reloc->sym->sec,
2335 insn = find_insn(file, reloc->sym->sec, reloc_addend(reloc));
2371 insn = find_insn(file, reloc->sym->sec, reloc_addend(reloc));
2390 insn = find_insn(file, reloc->sym->sec, reloc_addend(reloc));
2418 insn = find_insn(file, reloc->sym->sec, reloc_addend(reloc));
2449 insn = find_insn(file, reloc->sym->sec, reloc_addend(reloc));
2468 insn->jump_dest = find_insn(file, insn->sec, dest_off);
2471 insn->sec->name, dest_off);
2537 struct section *sec;
2550 for_each_sec(file, sec) {
2551 if (!strncmp(sec->name, ".rodata", 7) &&
2552 !strstr(sec->name, ".str1.")) {
2553 sec->rodata = true;
3247 char *where = offstr(insn->sec, insn->offset);
3387 if (!target->sec->noinstr) {
3414 if (func->sec->noinstr)
3548 struct section *sec;
3552 sec = insn->sec;
3779 WARN("%s: unexpected end of section", sec->name);
3804 static int validate_unwind_hints(struct objtool_file *file, struct section *sec)
3813 init_insn_state(file, &state, sec);
3815 if (sec) {
3816 sec_for_each_insn(file, sec, insn)
3894 dest = find_insn(file, insn_call_dest(insn)->sec,
3974 if (insn->sec->init)
4018 if (!strcmp(insn->sec->name, ".altinstr_replacement") ||
4019 !strcmp(insn->sec->name, ".altinstr_aux"))
4031 int size = find_symbol_hole_containing(insn->sec, insn->offset);
4121 insn = find_insn(file, func->sec, func->offset);
4166 struct section *sec;
4169 for_each_sec(file, sec) {
4170 if (!(sec->sh.sh_flags & SHF_EXECINSTR))
4173 sec_for_each_sym(sec, func) {
4184 static int validate_symbol(struct objtool_file *file, struct section *sec,
4198 insn = find_insn(file, sec, sym->offset);
4210 static int validate_section(struct objtool_file *file, struct section *sec)
4216 sec_for_each_sym(sec, func) {
4220 init_insn_state(file, &state, sec);
4223 warnings += validate_symbol(file, sec, func, &state);
4231 struct section *sec;
4234 sec = find_section_by_name(file->elf, ".noinstr.text");
4235 if (sec) {
4236 warnings += validate_section(file, sec);
4237 warnings += validate_unwind_hints(file, sec);
4240 sec = find_section_by_name(file->elf, ".entry.text");
4241 if (sec) {
4242 warnings += validate_section(file, sec);
4243 warnings += validate_unwind_hints(file, sec);
4246 sec = find_section_by_name(file->elf, ".cpuidle.text");
4247 if (sec) {
4248 warnings += validate_section(file, sec);
4249 warnings += validate_unwind_hints(file, sec);
4257 struct section *sec;
4260 for_each_sec(file, sec) {
4261 if (!(sec->sh.sh_flags & SHF_EXECINSTR))
4264 warnings += validate_section(file, sec);
4278 struct symbol *sym = find_symbol_containing(insn->sec, insn->offset-1);
4284 first = find_insn(file, sym->sec, sym->offset);
4321 reloc = find_reloc_by_dest_range(file->elf, insn->sec,
4339 dest = find_insn(file, reloc->sym->sec, off);
4381 WARN_INSN(insn, "relocation to !ENDBR: %s", offstr(dest->sec, dest->offset));
4394 dest = find_insn(file, reloc->sym->sec,
4408 reloc->sec->base, reloc_offset(reloc),
4409 offstr(dest->sec, dest->offset));
4421 struct section *sec;
4429 for_each_sec(file, sec) {
4432 if (sec->sh.sh_flags & SHF_EXECINSTR)
4435 if (!sec->rsec)
4442 if ((!strncmp(sec->name, ".discard", 8) &&
4443 strcmp(sec->name, ".discard.ibt_endbr_noseal")) ||
4444 !strncmp(sec->name, ".debug", 6) ||
4445 !strcmp(sec->name, ".altinstructions") ||
4446 !strcmp(sec->name, ".ibt_endbr_seal") ||
4447 !strcmp(sec->name, ".orc_unwind_ip") ||
4448 !strcmp(sec->name, ".parainstructions") ||
4449 !strcmp(sec->name, ".retpoline_sites") ||
4450 !strcmp(sec->name, ".smp_locks") ||
4451 !strcmp(sec->name, ".static_call_sites") ||
4452 !strcmp(sec->name, "_error_injection_whitelist") ||
4453 !strcmp(sec->name, "_kprobe_blacklist") ||
4454 !strcmp(sec->name, "__bug_table") ||
4455 !strcmp(sec->name, "__ex_table") ||
4456 !strcmp(sec->name, "__jump_table") ||
4457 !strcmp(sec->name, "__mcount_loc") ||
4458 !strcmp(sec->name, ".kcfi_traps") ||
4459 strstr(sec->name, "__patchable_function_entries"))
4462 for_each_reloc(sec->rsec, reloc)