From patchwork Wed Jun 22 10:13:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen Zhongjin X-Patchwork-Id: 12890457 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 812E5C43334 for ; Wed, 22 Jun 2022 10:19:13 +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: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:In-Reply-To:References: List-Owner; bh=Z7eAmHT00K94TwsdcO5RwvwIZJr3uls2JjH5fAHJFGI=; b=uTfCVyY9NIhgwQ A3Ii1t1zXdJXfEq3JlZi5Sjb1+5SE4YP957oBvTL2B4EE+ccee8yMp5LSt5hXxOABwx3CcLU2FAGM SMP1O+XoWMfucS54vGGiNykz7/sJEoKFk8UWX7E1+Y2GSgLDQIjLfd7lAzYjvybqv+KWopzpB4W/X zLr2jzQQoWchnmWRKsqOYy/siQPxyGIHF4rwhA8sxM3G16hWabBnZLZni3AIM+NFOFwSgZopF2OTx RUomVJuS3G2tUTSIhMfowXo8zI7DOh0Eao26OV0OoxbIxHv7Q5fDVpE4g0ZVvkALyXYSm/YcMx7Th yVvEHp58t/yWCQyk5jJg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o3xQy-009pLP-1g; Wed, 22 Jun 2022 10:18:04 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o3xPR-009oex-AP for linux-arm-kernel@bombadil.infradead.org; Wed, 22 Jun 2022 10:16:29 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Type:MIME-Version:Message-ID: Date:Subject:CC:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:In-Reply-To:References; bh=kUPpF18LwuT1rjRHXrE+KmM3fX9sch9NRv4uUFVrkYI=; b=M4P8IIWgunP4uOAdwqbBkOZCJM G6sEuVjjdRbeO312QiMUXJeJ/sgZUjbf9MiRaXZugTbktESTI9Vxh4wnhbI/sC7ImTImtWulpnZ7p 5jWRm6oViGfoYCvY9h559A68/McBJlsfFEyYVScJLe7NEmZudryQz8YQaAD9hi2LXuAOrohVdHJBR 9ce8S9RjYPFYBr7C5Pcig7/R0Pb6B2GhlUrsPcqTVD1rdMboLGmTwPTPOHlMrxlkRlZwc0miEeyB7 0NxnPLS/V4FpHa21T3oRjaeCRJ0sKSpwdyT7tCkSf4eGBK+fIU8wKcPYRf435nEQYbGm37sIbhJAA HXRpNJhA==; Received: from szxga02-in.huawei.com ([45.249.212.188]) by desiato.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o3xPK-00AzZ4-OS for linux-arm-kernel@lists.infradead.org; Wed, 22 Jun 2022 10:16:25 +0000 Received: from dggpemm500022.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4LSfMV2w5KzSh96; Wed, 22 Jun 2022 18:12:38 +0800 (CST) Received: from dggpemm500013.china.huawei.com (7.185.36.172) by dggpemm500022.china.huawei.com (7.185.36.162) 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 18:15:56 +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 18:15:56 +0800 From: Chen Zhongjin To: , , , , , CC: , , , , , Subject: [PATCH v2 0/5] objtool: Reorganize x86 arch-specific code Date: Wed, 22 Jun 2022 18:13:39 +0800 Message-ID: <20220622101344.38002-1-chenzhongjin@huawei.com> X-Mailer: git-send-email 2.17.1 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_111623_889085_A2C005F9 X-CRM114-Status: UNSURE ( 7.86 ) 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 This patch set reorganize current x86 related code in objtool, [1-3] move arch-specific to arch files and extract some common codes, [4] fixes a cross-compile problem and [5] fixes a call destination search bug. It make objtool more arch-generic, which makes other patches on different architectures easier to be reviewed and merged. Tested on x86 with unwind on kernel and module context. --- v2 Change: [5/5] objtool: use arch_jump_destination in read_intra_function_calls --- Chen Zhongjin (3): objtool: Add generic symbol for relocation type objtool: Specify host-arch for making LIBSUBCMD objtool: use arch_jump_destination in read_intra_function_calls Madhavan T. Venkataraman (2): objtool: Make ORC type code arch-specific objtool: Make ORC init and lookup code arch-generic arch/x86/include/asm/unwind.h | 5 - arch/x86/kernel/module.c | 7 +- arch/x86/kernel/unwind_orc.c | 256 +---------------- arch/x86/kernel/vmlinux.lds.S | 2 +- .../asm => include/asm-generic}/orc_lookup.h | 42 +++ kernel/Makefile | 2 + kernel/orc_lookup.c | 261 ++++++++++++++++++ tools/objtool/Makefile | 2 +- tools/objtool/arch/x86/Build | 1 + tools/objtool/arch/x86/include/arch/elf.h | 5 +- tools/objtool/arch/x86/orc.c | 137 +++++++++ tools/objtool/arch/x86/special.c | 5 +- tools/objtool/check.c | 14 +- tools/objtool/include/objtool/orc.h | 17 ++ tools/objtool/orc_dump.c | 59 +--- tools/objtool/orc_gen.c | 79 +----- 16 files changed, 492 insertions(+), 402 deletions(-) rename {arch/x86/include/asm => include/asm-generic}/orc_lookup.h (51%) create mode 100644 kernel/orc_lookup.c create mode 100644 tools/objtool/arch/x86/orc.c create mode 100644 tools/objtool/include/objtool/orc.h