mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "tip-bot2 for Josh Poimboeuf" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: kernel test robot <lkp@intel.com>,
	Josh Poimboeuf <jpoimboe@kernel.org>,
	"Peter Zijlstra (Intel)" <peterz@infradead.org>,
	Miroslav Benes <mbenes@suse.cz>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: objtool/core] objtool: Include weak functions in global_noreturns check
Date: Mon, 17 Apr 2023 10:46:46 -0000	[thread overview]
Message-ID: <168172840649.404.8270052350550677405.tip-bot2@tip-bot2> (raw)
In-Reply-To: <ede3460d63f4a65d282c86f1175bd2662c2286ba.1681342859.git.jpoimboe@kernel.org>

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@kernel.org>
AuthorDate:    Wed, 12 Apr 2023 16:49:37 -07:00
Committer:     Peter Zijlstra <peterz@infradead.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@intel.com>
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Miroslav Benes <mbenes@suse.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;
 

  parent reply	other threads:[~2023-04-17 10:51 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-12 23:49 [PATCH v2 00/11] Sprinkle more __noreturn Josh Poimboeuf
2023-04-12 23:49 ` [PATCH v2 01/11] init: Mark [arch_call_]rest_init() __noreturn Josh Poimboeuf
2023-04-17 10:46   ` [tip: objtool/core] " tip-bot2 for Josh Poimboeuf
2023-04-12 23:49 ` [PATCH v2 02/11] init: Mark start_kernel() __noreturn Josh Poimboeuf
2023-04-17 10:46   ` [tip: objtool/core] " tip-bot2 for Josh Poimboeuf
2023-04-12 23:49 ` [PATCH v2 03/11] x86/head: Mark *_start_kernel() __noreturn Josh Poimboeuf
2023-04-17 10:46   ` [tip: objtool/core] " tip-bot2 for Josh Poimboeuf
2023-04-12 23:49 ` [PATCH v2 04/11] arm64/cpu: Mark cpu_park_loop() and friends __noreturn Josh Poimboeuf
2023-04-17 10:46   ` [tip: objtool/core] " tip-bot2 for Josh Poimboeuf
2023-04-12 23:49 ` [PATCH v2 05/11] cpu: Mark panic_smp_self_stop() __noreturn Josh Poimboeuf
2023-04-17 10:46   ` [tip: objtool/core] " tip-bot2 for Josh Poimboeuf
2023-04-12 23:49 ` [PATCH v2 06/11] cpu: Mark nmi_panic_self_stop() __noreturn Josh Poimboeuf
2023-04-17 10:46   ` [tip: objtool/core] " tip-bot2 for Josh Poimboeuf
2023-04-12 23:49 ` [PATCH v2 07/11] objtool: Include weak functions in global_noreturns check Josh Poimboeuf
2023-04-14 14:32   ` Miroslav Benes
2023-04-17 10:46   ` tip-bot2 for Josh Poimboeuf [this message]
2023-04-12 23:49 ` [PATCH v2 08/11] btrfs: Mark btrfs_assertfail() __noreturn Josh Poimboeuf
2023-04-13 14:57   ` David Sterba
2023-04-15  7:19   ` Anand Jain
2023-04-17 10:46   ` [tip: objtool/core] " tip-bot2 for Josh Poimboeuf
2023-04-12 23:49 ` [PATCH v2 09/11] x86/cpu: Mark {hlt,resume}_play_dead() __noreturn Josh Poimboeuf
2023-04-17 10:46   ` [tip: objtool/core] " tip-bot2 for Josh Poimboeuf
2023-04-12 23:49 ` [PATCH v2 10/11] scsi: message: fusion: Mark mpt_halt_firmware() __noreturn Josh Poimboeuf
2023-04-17 10:46   ` [tip: objtool/core] " tip-bot2 for Josh Poimboeuf
2023-04-12 23:49 ` [PATCH v2 11/11] x86/hyperv: Mark hv_ghcb_terminate() as noreturn Josh Poimboeuf
2023-04-17 10:46   ` [tip: objtool/core] " tip-bot2 for Guilherme G. Piccoli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=168172840649.404.8270052350550677405.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=jpoimboe@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=mbenes@suse.cz \
    --cc=peterz@infradead.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®