From patchwork Tue Feb 14 07:05:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josh Poimboeuf X-Patchwork-Id: 13139543 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 84668C61DA4 for ; Tue, 14 Feb 2023 07:20:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=9w3jWPRJZQG7Gat9CLfxRgpIYOZaAI59dW5xFzpPUJo=; b=h94ECET7LafdKN vmrhxg3YawdtV5EkR8xkr6UZXRpI/mEnbKCEGfXwYKIUDBRj5huKdA2TDm2AoNXgnUqgGolBug/Zm XFp9d+a9sf4qELO48KwWX8vvmbKHdg6ha2JhWToDVxwtNeVCA2RYoJIDeg1ggpWfdk/xQB7HbB7Gu Ri2b+oKMZVrjobI/b6Yy4qf64sZtGfeIFtvJS3p6mStO0Reqx4A8qj3j2lp4h35ailovrkldxk9Lf NGemKNSQMBtRBR2LUtO7/AcH4NMiI27dc3hkQPmDoKw1jUDnWcdRypMxEtySM0KK819hBdUqIKkyA SKEVzmRDQ141i8C2LLkw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pRpad-000Dni-72; Tue, 14 Feb 2023 07:19:01 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pRpPY-0008Aq-0G for linux-arm-kernel@lists.infradead.org; Tue, 14 Feb 2023 07:07:33 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A26B0B81C03; Tue, 14 Feb 2023 07:07:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BC0DAC433A7; Tue, 14 Feb 2023 07:07:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1676358449; bh=nPbz5xOaaR7NDhO9DoSuJHej7ImmCT6qFtXYRUPe9iQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QbCTtkRPMFx4nrooNoGOfJ3srlkvjL8Q0JxwwQRhbw7JzTw4E1NOcM5votUGXjcOI bwNIVjqgBxHXFasgtTguxT+q1aIxc/mIWyCxPg++08GBZnfqopz3bkDonDMIpf4Ky9 LmmejYIb2RbvOM7BgY+ZPOyErGEpT84i2NpQdf7XK4tjGwSwp3MPtl4eDCfgFp/0sU PCvytiHTDPIi7VsxHtMruoDNWWKI9PdaGlVl4DlIHdnjzm/hwestBwEfWhfAeSH1C4 KmGJSiECze1iTyVfMoQ6R5LBQk+n9PkrMQAZBkTScLTVqvsxTvSumqYOrTmbP/39QF i1ONpamZqe3NQ== From: Josh Poimboeuf To: linux-kernel@vger.kernel.org Cc: jgross@suse.com, richard.henderson@linaro.org, ink@jurassic.park.msu.ru, mattst88@gmail.com, linux-alpha@vger.kernel.org, linux@armlinux.org.uk, linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com, will@kernel.org, guoren@kernel.org, linux-csky@vger.kernel.org, linux-ia64@vger.kernel.org, chenhuacai@kernel.org, kernel@xen0n.name, loongarch@lists.linux.dev, f.fainelli@gmail.com, bcm-kernel-feedback-list@broadcom.com, tsbogend@alpha.franken.de, linux-mips@vger.kernel.org, jiaxun.yang@flygoat.com, mpe@ellerman.id.au, npiggin@gmail.com, christophe.leroy@csgroup.eu, linuxppc-dev@lists.ozlabs.org, ysato@users.sourceforge.jp, dalias@libc.org, linux-sh@vger.kernel.org, davem@davemloft.net, sparclinux@vger.kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, chris@zankel.net, jcmvbkbc@gmail.com, linux-xtensa@linux-xtensa.org, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, bristot@redhat.com, vschneid@redhat.com, paulmck@kernel.org Subject: [PATCH v2 22/24] objtool: Include weak functions in 'global_noreturns' check Date: Mon, 13 Feb 2023 23:05:56 -0800 Message-Id: <85c4281eecd9388e7b3b21ef550119caa5305327.1676358308.git.jpoimboe@kernel.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230213_230732_213253_24CEA811 X-CRM114-Status: GOOD ( 11.56 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org If a global __noreturn function prototype has a corresponding weak function, it should also be __noreturn. Signed-off-by: Josh Poimboeuf --- 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 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;