diff mbox series

[v2,22/24] objtool: Include weak functions in 'global_noreturns' check

Message ID 85c4281eecd9388e7b3b21ef550119caa5305327.1676358308.git.jpoimboe@kernel.org (mailing list archive)
State New, archived
Headers show
Series cpu,sched: Mark arch_cpu_idle_dead() __noreturn | expand

Commit Message

Josh Poimboeuf Feb. 14, 2023, 7:05 a.m. UTC
If a global __noreturn function prototype has a corresponding weak
function, it should also be __noreturn.

Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
---
 tools/objtool/check.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index ba07a8ebaf73..0a1cf867d9b2 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -193,14 +193,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;