Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

objtool: Mark .cold subfunctions

Introduce a flag to identify .cold subfunctions so they can be detected
easier and faster.

Acked-by: Petr Mladek <pmladek@suse.com>
Tested-by: Joe Lawrence <joe.lawrence@redhat.com>
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>

+17 -17
+6 -8
tools/objtool/check.c
··· 1575 1575 /* 1576 1576 * Cross-function jump. 1577 1577 */ 1578 - if (func && insn_func(jump_dest) && func != insn_func(jump_dest)) { 1578 + 1579 + if (func && insn_func(jump_dest) && !func->cold && 1580 + insn_func(jump_dest)->cold) { 1579 1581 1580 1582 /* 1581 1583 * For GCC 8+, create parent/child links for any cold ··· 1594 1592 * case where the parent function's only reference to a 1595 1593 * subfunction is through a jump table. 1596 1594 */ 1597 - if (!strstr(func->name, ".cold") && 1598 - strstr(insn_func(jump_dest)->name, ".cold")) { 1599 - func->cfunc = insn_func(jump_dest); 1600 - insn_func(jump_dest)->pfunc = func; 1601 - } 1595 + func->cfunc = insn_func(jump_dest); 1596 + insn_func(jump_dest)->pfunc = func; 1602 1597 } 1603 1598 1604 1599 if (jump_is_sibling_call(file, insn, jump_dest)) { ··· 4065 4066 * If this hole jumps to a .cold function, mark it ignore too. 4066 4067 */ 4067 4068 if (insn->jump_dest && insn_func(insn->jump_dest) && 4068 - strstr(insn_func(insn->jump_dest)->name, ".cold")) { 4069 + insn_func(insn->jump_dest)->cold) 4069 4070 insn_func(insn->jump_dest)->ignore = true; 4070 - } 4071 4071 } 4072 4072 4073 4073 return false;
+10 -9
tools/objtool/elf.c
··· 441 441 list_add(&sym->list, entry); 442 442 elf_hash_add(symbol, &sym->hash, sym->idx); 443 443 elf_hash_add(symbol_name, &sym->name_hash, str_hash(sym->name)); 444 + 445 + if (is_func_sym(sym) && strstr(sym->name, ".cold")) 446 + sym->cold = 1; 447 + sym->pfunc = sym->cfunc = sym; 444 448 } 445 449 446 450 static int read_symbols(struct elf *elf) ··· 531 527 sec_for_each_sym(sec, sym) { 532 528 char *pname; 533 529 size_t pnamelen; 534 - if (!is_func_sym(sym)) 530 + 531 + if (!sym->cold) 535 532 continue; 536 - 537 - if (sym->pfunc == NULL) 538 - sym->pfunc = sym; 539 - 540 - if (sym->cfunc == NULL) 541 - sym->cfunc = sym; 542 533 543 534 coldstr = strstr(sym->name, ".cold"); 544 - if (!coldstr) 545 - continue; 535 + if (!coldstr) { 536 + ERROR("%s(): cold subfunction without \".cold\"?", sym->name); 537 + return -1; 538 + } 546 539 547 540 pnamelen = coldstr - sym->name; 548 541 pname = strndup(sym->name, pnamelen);
+1
tools/objtool/include/objtool/elf.h
··· 72 72 u8 frame_pointer : 1; 73 73 u8 ignore : 1; 74 74 u8 nocfi : 1; 75 + u8 cold : 1; 75 76 struct list_head pv_target; 76 77 struct reloc *relocs; 77 78 struct section *group_sec;