From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2F1EE72 for ; Tue, 28 Sep 2021 15:42:03 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 39AAB6124A; Tue, 28 Sep 2021 15:42:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1632843722; bh=ChBTgQnPISjb8SQT8vWLdwVriUt/cxd344Ze2iJ0p7Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oNHfa5g3ugbxuSJXsdCVKKN4KoBMnKJ4s8mwhvIKTWsRj937WLHOkG4ks4dwPIt1V nas4ZGB/oIlv2dSmA21whS129X4oalvkfH00iw1ZTCSm2JobngMJ3k7SuFjCOQurXl iGdC+a5DwwMk0exGZd+pmCSvL0+kHBEK2ZzwsZHn+myS0M7Mhgy1wBNpxZ+lnKWCcN Ujwag5g28nLObpQDE4swreLoALz6evy8c6kPi15g7R3f10Q2Cyoi4wbL6HtbJ7nt/D mIm/gsuA4BttvHd+0nRVFjFU3qwg6rsjDm5YxeoMxwA4bDNVkc+Os5tLQCBYlWiNIX Y5oGtyzEZc0Aw== From: Arnd Bergmann To: Russell King Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Arnd Bergmann , Ard Biesheuvel , Linus Walleij , Nathan Chancellor , Nick Desaulniers , llvm@lists.linux.dev Subject: [PATCH 02/14] ARM: patch: fix BE32 compilation Date: Tue, 28 Sep 2021 17:41:31 +0200 Message-Id: <20210928154143.2106903-3-arnd@kernel.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210928154143.2106903-1-arnd@kernel.org> References: <20210928154143.2106903-1-arnd@kernel.org> Precedence: bulk X-Mailing-List: llvm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Arnd Bergmann On BE32 kernels, the __opcode_to_mem_thumb32() interface is intentionally not defined, but it is referenced whenever runtime patching is enabled for the kernel, which may be for ftrace, jump label, kprobes or kgdb: arch/arm/kernel/patch.c: In function '__patch_text_real': arch/arm/kernel/patch.c:94:32: error: implicit declaration of function '__opcode_to_mem_thumb32' [-Werror=implicit-function-declaration] 94 | insn = __opcode_to_mem_thumb32(insn); | ^~~~~~~~~~~~~~~~~~~~~~~ Since BE32 kernels never run Thumb2 code, we never end up using the result of this call, so providing an extern declaration without a definition makes it build correctly. Signed-off-by: Arnd Bergmann --- arch/arm/include/asm/opcodes.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/arch/arm/include/asm/opcodes.h b/arch/arm/include/asm/opcodes.h index 6bff94b2372b..38e3eabff5c3 100644 --- a/arch/arm/include/asm/opcodes.h +++ b/arch/arm/include/asm/opcodes.h @@ -110,12 +110,17 @@ extern asmlinkage unsigned int arm_check_condition(u32 opcode, u32 psr); #define __opcode_to_mem_thumb16(x) ___opcode_identity16(x) #define ___asm_opcode_to_mem_arm(x) ___asm_opcode_identity32(x) #define ___asm_opcode_to_mem_thumb16(x) ___asm_opcode_identity16(x) -#ifndef CONFIG_CPU_ENDIAN_BE32 +#ifdef CONFIG_CPU_ENDIAN_BE32 +#ifndef __ASSEMBLY__ /* * On BE32 systems, using 32-bit accesses to store Thumb instructions will not * work in all cases, due to alignment constraints. For now, a correct - * version is not provided for BE32. + * version is not provided for BE32, but the prototype needs to be there + * to compile patch.c. */ +extern __u32 __opcode_to_mem_thumb32(__u32); +#endif +#else #define __opcode_to_mem_thumb32(x) ___opcode_swahw32(x) #define ___asm_opcode_to_mem_thumb32(x) ___asm_opcode_swahw32(x) #endif -- 2.29.2 From mboxrd@z Thu Jan 1 00:00:00 1970 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 907D0C433EF for ; Tue, 28 Sep 2021 15:45:14 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 60AB761206 for ; Tue, 28 Sep 2021 15:45:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 60AB761206 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org 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=uAzNKKuzITS2gBWFcmqhahnRO4IszG/Uv1vWmSFo3Yk=; b=zZOJadw4U/mJ8O XGIxw5/WRbSlUUbHN50uagZ1SHo/tYPkAJzcRfm7duZZqVxR6hz6TnSTeltOyLtXthLW6GAfeVGRG 6jbOdy3ztg3yICd1Qncr3dcW8zqKmdJpArFKGnINu7JXVHw3CxFUV50U78U9lhXUlttHiWi2z6OMI 0HUYZOWChHBUl3pqODtwhGY+6xrJQVuLQnEyqJY+T1wvNVKKAElDUzPfEw0c4Tj30eWH40gDlZlOA S+AkU8CcMYOTNKewc8calPLBPih4NqWBlbTP4LsVUnUTMEgCb1m4fujEXjVctVcpk8A9bE9JA6Eum aYZ/rYio82AlqIClnbSg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mVFFY-007oFb-GP; Tue, 28 Sep 2021 15:42:32 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mVFF5-007o4z-82 for linux-arm-kernel@lists.infradead.org; Tue, 28 Sep 2021 15:42:04 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 39AAB6124A; Tue, 28 Sep 2021 15:42:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1632843722; bh=ChBTgQnPISjb8SQT8vWLdwVriUt/cxd344Ze2iJ0p7Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oNHfa5g3ugbxuSJXsdCVKKN4KoBMnKJ4s8mwhvIKTWsRj937WLHOkG4ks4dwPIt1V nas4ZGB/oIlv2dSmA21whS129X4oalvkfH00iw1ZTCSm2JobngMJ3k7SuFjCOQurXl iGdC+a5DwwMk0exGZd+pmCSvL0+kHBEK2ZzwsZHn+myS0M7Mhgy1wBNpxZ+lnKWCcN Ujwag5g28nLObpQDE4swreLoALz6evy8c6kPi15g7R3f10Q2Cyoi4wbL6HtbJ7nt/D mIm/gsuA4BttvHd+0nRVFjFU3qwg6rsjDm5YxeoMxwA4bDNVkc+Os5tLQCBYlWiNIX Y5oGtyzEZc0Aw== From: Arnd Bergmann To: Russell King Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Arnd Bergmann , Ard Biesheuvel , Linus Walleij , Nathan Chancellor , Nick Desaulniers , llvm@lists.linux.dev Subject: [PATCH 02/14] ARM: patch: fix BE32 compilation Date: Tue, 28 Sep 2021 17:41:31 +0200 Message-Id: <20210928154143.2106903-3-arnd@kernel.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210928154143.2106903-1-arnd@kernel.org> References: <20210928154143.2106903-1-arnd@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210928_084203_344505_7FABD453 X-CRM114-Status: GOOD ( 13.48 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Arnd Bergmann On BE32 kernels, the __opcode_to_mem_thumb32() interface is intentionally not defined, but it is referenced whenever runtime patching is enabled for the kernel, which may be for ftrace, jump label, kprobes or kgdb: arch/arm/kernel/patch.c: In function '__patch_text_real': arch/arm/kernel/patch.c:94:32: error: implicit declaration of function '__opcode_to_mem_thumb32' [-Werror=implicit-function-declaration] 94 | insn = __opcode_to_mem_thumb32(insn); | ^~~~~~~~~~~~~~~~~~~~~~~ Since BE32 kernels never run Thumb2 code, we never end up using the result of this call, so providing an extern declaration without a definition makes it build correctly. Signed-off-by: Arnd Bergmann --- arch/arm/include/asm/opcodes.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/arch/arm/include/asm/opcodes.h b/arch/arm/include/asm/opcodes.h index 6bff94b2372b..38e3eabff5c3 100644 --- a/arch/arm/include/asm/opcodes.h +++ b/arch/arm/include/asm/opcodes.h @@ -110,12 +110,17 @@ extern asmlinkage unsigned int arm_check_condition(u32 opcode, u32 psr); #define __opcode_to_mem_thumb16(x) ___opcode_identity16(x) #define ___asm_opcode_to_mem_arm(x) ___asm_opcode_identity32(x) #define ___asm_opcode_to_mem_thumb16(x) ___asm_opcode_identity16(x) -#ifndef CONFIG_CPU_ENDIAN_BE32 +#ifdef CONFIG_CPU_ENDIAN_BE32 +#ifndef __ASSEMBLY__ /* * On BE32 systems, using 32-bit accesses to store Thumb instructions will not * work in all cases, due to alignment constraints. For now, a correct - * version is not provided for BE32. + * version is not provided for BE32, but the prototype needs to be there + * to compile patch.c. */ +extern __u32 __opcode_to_mem_thumb32(__u32); +#endif +#else #define __opcode_to_mem_thumb32(x) ___opcode_swahw32(x) #define ___asm_opcode_to_mem_thumb32(x) ___asm_opcode_swahw32(x) #endif -- 2.29.2 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel