[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <176371907577.498.9350060041272542842.tip-bot2@tip-bot2>
Date: Fri, 21 Nov 2025 09:57:55 -0000
From: "tip-bot2 for Josh Poimboeuf" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Josh Poimboeuf <jpoimboe@...nel.org>,
"Peter Zijlstra (Intel)" <peterz@...radead.org>, x86@...nel.org,
linux-kernel@...r.kernel.org
Subject:
[tip: objtool/core] objtool: Remove second pass of .cold function correlation
The following commit has been merged into the objtool/core branch of tip:
Commit-ID: 106f11d43be53156187270d00c83ddf5ef3f6ac6
Gitweb: https://git.kernel.org/tip/106f11d43be53156187270d00c83ddf5ef3f6ac6
Author: Josh Poimboeuf <jpoimboe@...nel.org>
AuthorDate: Thu, 20 Nov 2025 12:52:20 -08:00
Committer: Peter Zijlstra <peterz@...radead.org>
CommitterDate: Fri, 21 Nov 2025 10:04:08 +01:00
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@...nel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
Link: https://patch.msgid.link/bdab245a38000a5407f663a031f39e14c67a43d4.1763671318.git.jpoimboe@kernel.org
---
tools/objtool/check.c | 23 +----------------------
tools/objtool/elf.c | 3 ++-
2 files changed, 3 insertions(+), 23 deletions(-)
diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index 6a4a29f..1a20ff8 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -1623,34 +1623,13 @@ static int add_jump_destinations(struct objtool_file *file)
continue;
}
- if (!insn->sym || insn->sym == dest_insn->sym)
+ if (!insn->sym || insn->sym->pfunc == dest_sym->pfunc)
goto set_jump_dest;
/*
* Internal cross-function jump.
*/
- /*
- * For GCC 8+, create parent/child links for any cold
- * subfunctions. This is _mostly_ redundant with a
- * similar initialization in read_symbols().
- *
- * If a function has aliases, we want the *first* such
- * function in the symbol table to be the subfunction's
- * parent. In that case we overwrite the
- * initialization done in read_symbols().
- *
- * However this code can't completely replace the
- * read_symbols() code because this doesn't detect the
- * case where the parent function's only reference to a
- * subfunction is through a jump table.
- */
- if (func && dest_sym->cold) {
- func->cfunc = dest_sym;
- dest_sym->pfunc = func;
- goto set_jump_dest;
- }
-
if (is_first_func_insn(file, dest_insn)) {
/* Internal sibling call */
if (add_call_dest(file, insn, dest_sym, true))
diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c
index 7e2c0ae..6a8ed9c 100644
--- a/tools/objtool/elf.c
+++ b/tools/objtool/elf.c
@@ -658,8 +658,9 @@ static int read_symbols(struct elf *elf)
return -1;
}
- sym->pfunc = pfunc;
+ sym->pfunc = pfunc->alias;
pfunc->cfunc = sym;
+ pfunc->alias->cfunc = sym;
/*
* Unfortunately, -fnoreorder-functions puts the child
Powered by blists - more mailing lists