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: Remove second pass of .cold function correlation

The .cold function parent/child correlation logic has two passes: one in
read_symbols() and one in add_jump_destinations().

The second pass was added with commit cd77849a69cf ("objtool: Fix GCC 8
cold subfunction detection for aliased functions") to ensure that if the
parent symbol had aliases then the canonical symbol was chosen as the
parent.

That solution was rather clunky, not to mention incomplete due to the
existence of alternatives and switch tables. Now that we have
sym->alias, the canonical alias fix can be done much simpler in the
first pass, making the second pass obsolete.

Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/bdab245a38000a5407f663a031f39e14c67a43d4.1763671318.git.jpoimboe@kernel.org

authored by

Josh Poimboeuf and committed by
Peter Zijlstra
106f11d4 a91a61b2

+3 -23
+1 -22
tools/objtool/check.c
··· 1623 1623 continue; 1624 1624 } 1625 1625 1626 - if (!insn->sym || insn->sym == dest_insn->sym) 1626 + if (!insn->sym || insn->sym->pfunc == dest_sym->pfunc) 1627 1627 goto set_jump_dest; 1628 1628 1629 1629 /* 1630 1630 * Internal cross-function jump. 1631 1631 */ 1632 - 1633 - /* 1634 - * For GCC 8+, create parent/child links for any cold 1635 - * subfunctions. This is _mostly_ redundant with a 1636 - * similar initialization in read_symbols(). 1637 - * 1638 - * If a function has aliases, we want the *first* such 1639 - * function in the symbol table to be the subfunction's 1640 - * parent. In that case we overwrite the 1641 - * initialization done in read_symbols(). 1642 - * 1643 - * However this code can't completely replace the 1644 - * read_symbols() code because this doesn't detect the 1645 - * case where the parent function's only reference to a 1646 - * subfunction is through a jump table. 1647 - */ 1648 - if (func && dest_sym->cold) { 1649 - func->cfunc = dest_sym; 1650 - dest_sym->pfunc = func; 1651 - goto set_jump_dest; 1652 - } 1653 1632 1654 1633 if (is_first_func_insn(file, dest_insn)) { 1655 1634 /* Internal sibling call */
+2 -1
tools/objtool/elf.c
··· 658 658 return -1; 659 659 } 660 660 661 - sym->pfunc = pfunc; 661 + sym->pfunc = pfunc->alias; 662 662 pfunc->cfunc = sym; 663 + pfunc->alias->cfunc = sym; 663 664 664 665 /* 665 666 * Unfortunately, -fnoreorder-functions puts the child