[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <168172840649.404.8270052350550677405.tip-bot2@tip-bot2>
Date: Mon, 17 Apr 2023 10:46:46 -0000
From: "tip-bot2 for Josh Poimboeuf" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: kernel test robot <lkp@...el.com>,
Josh Poimboeuf <jpoimboe@...nel.org>,
"Peter Zijlstra (Intel)" <peterz@...radead.org>,
Miroslav Benes <mbenes@...e.cz>, x86@...nel.org,
linux-kernel@...r.kernel.org
Subject: [tip: objtool/core] objtool: Include weak functions in global_noreturns check
The following commit has been merged into the objtool/core branch of tip:
Commit-ID: 1c47c8758a11345ac643fa68cb70b708a6668883
Gitweb: https://git.kernel.org/tip/1c47c8758a11345ac643fa68cb70b708a6668883
Author: Josh Poimboeuf <jpoimboe@...nel.org>
AuthorDate: Wed, 12 Apr 2023 16:49:37 -07:00
Committer: Peter Zijlstra <peterz@...radead.org>
CommitterDate: Fri, 14 Apr 2023 17:31:26 +02:00
objtool: Include weak functions in global_noreturns check
If a global function doesn't return, and its prototype has the
__noreturn attribute, its weak counterpart must also not return so that
it matches the prototype and meets call site expectations.
To properly follow the compiled control flow at the call sites, change
the global_noreturns check to include both global and weak functions.
On the other hand, if a weak function isn't in global_noreturns, assume
the prototype doesn't have __noreturn. Even if the weak function
doesn't return, call sites treat it like a returnable function.
Fixes the following warning:
kernel/sched/build_policy.o: warning: objtool: do_idle() falls through to next function play_idle_precise()
Reported-by: kernel test robot <lkp@...el.com>
Signed-off-by: Josh Poimboeuf <jpoimboe@...nel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
Reviewed-by: Miroslav Benes <mbenes@...e.cz>
Link: https://lore.kernel.org/r/ede3460d63f4a65d282c86f1175bd2662c2286ba.1681342859.git.jpoimboe@kernel.org
---
tools/objtool/check.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index 8d073bf..ae0c942 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -236,14 +236,14 @@ static bool __dead_end_function(struct objtool_file *file, struct symbol *func,
if (!func)
return false;
- if (func->bind == STB_WEAK)
- return false;
-
- if (func->bind == STB_GLOBAL)
+ if (func->bind == STB_GLOBAL || func->bind == STB_WEAK)
for (i = 0; i < ARRAY_SIZE(global_noreturns); i++)
if (!strcmp(func->name, global_noreturns[i]))
return true;
+ if (func->bind == STB_WEAK)
+ return false;
+
if (!func->len)
return false;
Powered by blists - more mailing lists