Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp5007897pxb; Tue, 28 Sep 2021 08:43:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzz3X5u4RaNU4hD5Zee1nKOLJogESXfNNIGfgfti2jNoXdJdeWq7gj4XK1GKG6kaXxw2UcQ X-Received: by 2002:a17:90a:718c:: with SMTP id i12mr685052pjk.182.1632843798706; Tue, 28 Sep 2021 08:43:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632843798; cv=none; d=google.com; s=arc-20160816; b=jCgfujK0K6PNMnnbqv0SlauGLYjaesrRfmAAv1YPDvjsihMgla+qpPSabfmIbalaxU wWtac2i5xc4z2IK4BGGl5FtJENQnE3jqW2ayJwOyLrljp+FrlmG8p5qgm+pKYQk4KxZ3 ePplJWzjI9KSr5JrjhIoy4F5Y1S8iRXERQEJIlgnrvoeNVQw3DXPyj1o0DsOPQT5QWkH +heaHGsFymAjMovm6Zz2v4Q7n2YYasE6So1KuYg47kSWsTyWXBSV9HH9RQBmEooZ1jY2 tob5jV94mWV6rngkzxQZpLn0am2CutQ/uJk8ZuiYKlVia73Xm8guIaNsjk631tLUPhna o8Jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=zYnosDRVQZ44oqQ+MGFBwN0xp51abTIaBS5pPxbSgjw=; b=XKU191yBqlQ+pUdZbvf2037oR2yP82FeO1L7QW+XHnCBpug5Nl2DIxjNz23gozgVzC EYeJSNuFxdC51o/TEnNEl5hEfLQYh1za1+GXxU3EQIwMXOGSn8TJM4lKQHdsHx1NoFVS 8mUJy5u6i+TiwIynikjujsspqu9fbhdTAfY35ZxBS2i3hab9LIFA7xyHTVOtO9mZLj6Y IGGP6rnbz38gwz8n+2FlXOoz6kmRpNsAqjpodCdfOHI/PuVEHpz6/vq7CCIyADBM756C OOgjmkLYOFOoS6ZVrkeuiw9QwYJ+ow7Xk2ztWD7lF+1PpJfKThvEbkSHiwZryML5f+1w gEag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=oNHfa5g3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c17si7197705pfj.271.2021.09.28.08.43.05; Tue, 28 Sep 2021 08:43:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=oNHfa5g3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241738AbhI1Pnr (ORCPT + 99 others); Tue, 28 Sep 2021 11:43:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:60376 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241652AbhI1Pnm (ORCPT ); Tue, 28 Sep 2021 11:43:42 -0400 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 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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