From patchwork Wed Jun 22 15:49:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen Zhongjin X-Patchwork-Id: 12891119 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 6607EC43334 for ; Wed, 22 Jun 2022 16:17:27 +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=7eN7lGuZL8CwBuxlp7xJjFxJm7EwGkd804PIxgvRB74=; b=kKthqEOtbPqcFb kabvL8SZATDwpfCsa7vG6uJCnwrhMNyT/4Nh4HFrYPUgMXjPaUTC4FN+kF4uNUaIVnSuOHscC97kr 6XmjIyjuxafeZk84vuNhQiHJ85vr+GNb58fWgVFEb+oo41UjYxlizj0D4jJViSO/ponFl2TJMuoQZ u46JqQptacCLGsN6MKQTEFD5MJd6ud0crVSDg1O3ic2riEw1Pj0aSs5sAyTmLVg7vBMAld3jkbNQO Z7q4VOEHuAvroLYvQ0iXAgU2IyG+zJWCfTtDv2Xnmmukl6QRn6KLUNu7jcpqHQE3QKDe9A7AQUz0P QFhyK1fHp8eh6WhQnzmQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o431b-00BRQW-DS; Wed, 22 Jun 2022 16:16:15 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o42fi-00BI5e-50 for linux-arm-kernel@bombadil.infradead.org; Wed, 22 Jun 2022 15:53:38 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:CC:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=zg5gaWyD0Uu9WYjsdSL3Lo2ijL9wVj6sujJXXGR3+Z8=; b=mBKDzUsJbdiJ7kJcAor4LcBPKj aqLOgMTZ17tTmqvk3pUvPAQt8meCR9J+yW4KWdRwTPRkZQkBXpsY4b3u4Awfd56LK6SfuDciTHk/G BoLN1m4pO3s32+6Nt0XwWcDy+3qT3XWkxXhrJ6+DFVGVDpC7xF7eZYFOR9eFJzoXBMiWquNQ13HTJ O5Jbyd8ycetE6E17e5ums523MjDPaVO5AFWy3WKRVARji7tj4udX1JAM3k8eWEzMuZkRm6ozD+qZq o5U4B5XJ244rhy/qlvi9e99Y94eoHQSa3SVkHL4Vji13UjZy8zG+YXNAAOG1ZcNiauBsKXOuYYSz0 WSijwoaQ==; Received: from szxga01-in.huawei.com ([45.249.212.187]) by casper.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o42fb-0077Ua-HA for linux-arm-kernel@lists.infradead.org; Wed, 22 Jun 2022 15:53:36 +0000 Received: from dggpemm500024.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4LSntb4cNMzkWg4; Wed, 22 Jun 2022 23:51:35 +0800 (CST) Received: from dggpemm500013.china.huawei.com (7.185.36.172) by dggpemm500024.china.huawei.com (7.185.36.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 22 Jun 2022 23:52:48 +0800 Received: from ubuntu1804.huawei.com (10.67.175.36) by dggpemm500013.china.huawei.com (7.185.36.172) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 22 Jun 2022 23:52:48 +0800 From: Chen Zhongjin To: , , , , , CC: , , , , , , , , , , , , , Subject: [PATCH v5 33/33] objtool: revert c_file fallthrough detection for arm64 Date: Wed, 22 Jun 2022 23:49:20 +0800 Message-ID: <20220622154920.95075-34-chenzhongjin@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220622154920.95075-1-chenzhongjin@huawei.com> References: <20220622154920.95075-1-chenzhongjin@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.175.36] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpemm500013.china.huawei.com (7.185.36.172) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220622_165332_228541_E780C66E X-CRM114-Status: UNSURE ( 9.75 ) X-CRM114-Notice: Please train this message. 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 'commit 08feafe8d195 ("objtool: Fix function fallthrough detection for vmlinux")' This commit canceled c_file which used to make fallthrough detection only works on C objects. However in arm64/crypto/aes-mods.S, there are cases that JUMP at the end of function which make objtool wrongly detected them as fall through. Revert c_file before this is fixed. Signed-off-by: Chen Zhongjin --- tools/objtool/check.c | 3 +-- tools/objtool/include/objtool/objtool.h | 2 +- tools/objtool/objtool.c | 1 + 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/objtool/check.c b/tools/objtool/check.c index 54b736e94ede..8b8a4ef81d96 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -540,7 +540,6 @@ static struct instruction *find_last_insn(struct objtool_file *file, struct instruction *insn = NULL; unsigned int offset; unsigned int end = (sec->sh.sh_size > 10) ? sec->sh.sh_size - 10 : 0; - for (offset = sec->sh.sh_size - 1; offset >= end && !insn; offset--) insn = find_insn(file, sec, offset); @@ -3219,7 +3218,7 @@ static int validate_branch(struct objtool_file *file, struct symbol *func, while (1) { next_insn = next_insn_to_validate(file, insn); - if (func && insn->func && func != insn->func->pfunc) { + if (file->c_file && func && insn->func && func != insn->func->pfunc) { WARN("%s() falls through to next function %s()", func->name, insn->func->name); return 1; diff --git a/tools/objtool/include/objtool/objtool.h b/tools/objtool/include/objtool/objtool.h index a6e72d916807..7a5c13a78f87 100644 --- a/tools/objtool/include/objtool/objtool.h +++ b/tools/objtool/include/objtool/objtool.h @@ -27,7 +27,7 @@ struct objtool_file { struct list_head static_call_list; struct list_head mcount_loc_list; struct list_head endbr_list; - bool ignore_unreachables, hints, rodata; + bool ignore_unreachables, c_file, hints, rodata; unsigned int nr_endbr; unsigned int nr_endbr_int; diff --git a/tools/objtool/objtool.c b/tools/objtool/objtool.c index 512669ce064c..d33620b1392d 100644 --- a/tools/objtool/objtool.c +++ b/tools/objtool/objtool.c @@ -105,6 +105,7 @@ struct objtool_file *objtool_open_read(const char *_objname) INIT_LIST_HEAD(&file.static_call_list); INIT_LIST_HEAD(&file.mcount_loc_list); INIT_LIST_HEAD(&file.endbr_list); + file.c_file = !opts.link && find_section_by_name(file.elf, ".comment"); file.ignore_unreachables = opts.no_unreachable; file.hints = false;