From patchwork Tue Aug 6 23:09:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Gomez via B4 Relay X-Patchwork-Id: 13755474 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 6CCEEC52D6F for ; Tue, 6 Aug 2024 23:16:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Reply-To:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To: References:Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version: Subject:Date:From:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=oVqKyJ7sCHW4ByYRkNZS+wQRSCmUSIIiS6NMdnp5mAs=; b=xyvAOTDVLbflC0kFVpbQm08LgB LRMhh/zl+6i7IekwbDjrEMQsy86VKisSBL8unBkJ1b68aG7bmMEJ7Ns3Wc8gDZMt3HVJ8Bdo5+eEE Sfx8DGcIIcLxPiznOx3tsVhKOo9DgT348+a3QEqqXP6lxxRks9C4ub0TiSFzKeTeoewmehwef6V1d uVOXEi/5FVcvygJex907oIenSng9tWx0JJGm/agS0EVifEFcPsDOM8aCyg528kZFtLCbRHHgn9Vpm Mj9DE4rEpZaA+fkUZLc1TLOMQlPAKmHWRWmukPnZVC/ZU2K0rlm4+E2aaeh8rmYRZdZl+BD7F2UcO 84r9M9xA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sbTPW-00000003Hiy-3McG; Tue, 06 Aug 2024 23:16:10 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sbTJf-00000003FhT-1MGg for linux-arm-kernel@lists.infradead.org; Tue, 06 Aug 2024 23:10:10 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 6FF7961161; Tue, 6 Aug 2024 23:10:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id AC059C4DDF2; Tue, 6 Aug 2024 23:10:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722985803; bh=9e5HihbYrzW+yqMwPJuNIyYK7+g4nznwrO87MB3vxcw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=o+lQ8BSoR4Ju/qZlqGOlRz8W2f4q625HDTETwcqpRBjBIpAHGmQ4EhMKKTCrVreRQ cIij2h8u3Uj6gXm5CHjB8ZQimA5YafQ9XWOV2o1uu3tZBWOvgIMFI8AFfFiJ0dI92M aoytBlmDJanRB8H64UdAlaPbXPnzN4D/Wc3OFyrsX5han8E3MgpLOUmmDDLWEAHz9y p+5O8jYXU7kKMItQ7ePyHdVWGORIV+pm5SYHGS28lg/JmvXwTxkuGKyTZ97qEWWWqF AjIMrzZ4mMs+L8E3mvHZQYOkKmBB3WEHGFQ6jwmqa8mALLsYxxk4D8WrcyhqZtG2kx h3F7SMY6psQPQ== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9C3E3C52D7C; Tue, 6 Aug 2024 23:10:03 +0000 (UTC) From: Daniel Gomez via B4 Relay Date: Wed, 07 Aug 2024 01:09:24 +0200 Subject: [PATCH 10/12] scripts/mod: add byteswap support MIME-Version: 1.0 Message-Id: <20240807-macos-build-support-v1-10-4cd1ded85694@samsung.com> References: <20240807-macos-build-support-v1-0-4cd1ded85694@samsung.com> In-Reply-To: <20240807-macos-build-support-v1-0-4cd1ded85694@samsung.com> To: Masahiro Yamada , Nathan Chancellor , Nicolas Schier , Lucas De Marchi , =?utf-8?q?Thomas_Hellstr=C3=B6?= =?utf-8?q?m?= , Rodrigo Vivi , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , William Hubbs , Chris Brannon , Kirk Reiser , Samuel Thibault , Paul Moore , Stephen Smalley , Ondrej Mosnacek , Catalin Marinas , Will Deacon , Marc Zyngier , Oliver Upton , James Morse , Suzuki K Poulose , Zenghui Yu , Greg Kroah-Hartman , Jiri Slaby , Nick Desaulniers , Bill Wendling , Justin Stitt Cc: linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org, intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org, speakup@linux-speakup.org, selinux@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-serial@vger.kernel.org, llvm@lists.linux.dev, Finn Behrens , "Daniel Gomez (Samsung)" , gost.dev@samsung.com, Daniel Gomez X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1722985800; l=5000; i=da.gomez@samsung.com; s=20240621; h=from:subject:message-id; bh=Qowyf7kXi1f6DRNle64eE+hm/m7HuihHCLdS1ou6yWA=; b=XP/CA3ITn/u6BrAjNNPHqWBAlVrrGINO1YjcxsqBUDayPo6aLVaS+rjtkAXOWZpLD9D5LKteD curVBFT06iiCK+55uBnnvP0sGKgQlV/aIMRgcPJ3CQmwNbgNCAfx2DS X-Developer-Key: i=da.gomez@samsung.com; a=ed25519; pk=BqYk31UHkmv0WZShES6pIZcdmPPGay5LbzifAdZ2Ia4= X-Endpoint-Received: by B4 Relay for da.gomez@samsung.com/20240621 with auth_id=175 X-Original-From: Daniel Gomez X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240806_161007_696815_EAF97C1B X-CRM114-Status: GOOD ( 19.77 ) 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: , Reply-To: da.gomez@samsung.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Daniel Gomez macOS hosts do not include byteswap.h header required for modpost objects. Add a copy of the string/byteswap.h from the GNU C Library (glibc), version glibc-2.40 into include/byteswap and update the modpost Makefile to include the library. Remove the following headers from glibc: diff --git a/include/byteswap/byteswap.h b/include/byteswap/byteswap.h index 66efb8fc4327..d27dd5e4bc6a 100644 --- a/include/byteswap/byteswap.h +++ b/include/byteswap/byteswap.h @@ -19,11 +19,6 @@ #ifndef _BYTESWAP_H #define _BYTESWAP_H 1 -#include - -/* Get the machine specific, optimized definitions. */ -#include - /* The following definitions must all be macros, otherwise some of the possible optimizations are not possible. */ Fixes build error for macOS: $SUBARCH is [arm64] HOSTCC scripts/mod/modpost.o HOSTCC scripts/mod/sumversion.o HOSTCC scripts/mod/symsearch.o HOSTCC scripts/mod/file2alias.o In file included from scripts/mod/symsearch.c:8: scripts/mod/modpost.h:2:10: fatal error: 'byteswap.h' file not found ^~~~~~~~~~~~ In file included from scripts/mod/sumversion.c:11: scripts/mod/modpost.h:2:10: fatal error: 'byteswap.h' file not found ^~~~~~~~~~~~ In file included from scripts/mod/modpost.c:23: scripts/mod/modpost.h:2:10: fatal error: 'byteswap.h' file not found ^~~~~~~~~~~~ 1 error generated. make[1]: *** [scripts/Makefile.host:133: scripts/mod/symsearch.o] Error 1 make[1]: *** Waiting for unfinished jobs.... 1 error generated. In file included from scripts/mod/file2alias.c:15: scripts/mod/modpost.h:2:10: fatal error: 'byteswap.h' file not found ^~~~~~~~~~~~ make[1]: *** [scripts/Makefile.host:133: scripts/mod/sumversion.o] Error 1 1 error generated. make[1]: *** [scripts/Makefile.host:133: scripts/mod/modpost.o] Error 1 1 error generated. make[1]: *** [scripts/Makefile.host:133: scripts/mod/file2alias.o] Error 1 make: *** [Makefile:1191: prepare0] Error 2 error: Recipe `kernel-build` failed with exit code 2 Fixes: bd78c9d71420 ("modpost: define TO_NATIVE() using bswap_* functions") build error for macOS. Signed-off-by: Daniel Gomez --- include/byteswap/byteswap.h | 35 +++++++++++++++++++++++++++++++++++ scripts/mod/Makefile | 8 ++++---- 2 files changed, 39 insertions(+), 4 deletions(-) diff --git a/include/byteswap/byteswap.h b/include/byteswap/byteswap.h new file mode 100644 index 000000000000..d27dd5e4bc6a --- /dev/null +++ b/include/byteswap/byteswap.h @@ -0,0 +1,35 @@ +/* Swap byte order for 16, 32 and 64 bit values + Copyright (C) 1997-2024 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _BYTESWAP_H +#define _BYTESWAP_H 1 + + +/* The following definitions must all be macros, otherwise some + of the possible optimizations are not possible. */ + +/* Return a value with both bytes in the 16 bit argument swapped. */ +#define bswap_16(x) __bswap_16 (x) + +/* Return a value with all bytes in the 32 bit argument swapped. */ +#define bswap_32(x) __bswap_32 (x) + +/* Return a value with all bytes in the 64 bit argument swapped. */ +#define bswap_64(x) __bswap_64 (x) + +#endif /* byteswap.h */ diff --git a/scripts/mod/Makefile b/scripts/mod/Makefile index 98b4cd8cc7e6..f398dcddef58 100644 --- a/scripts/mod/Makefile +++ b/scripts/mod/Makefile @@ -8,10 +8,10 @@ modpost-objs := modpost.o file2alias.o sumversion.o symsearch.o devicetable-offsets-file := devicetable-offsets.h -HOSTCFLAGS_modpost.o = -I$(srctree)/include/elf -HOSTCFLAGS_file2alias.o = -I$(srctree)/include/elf -HOSTCFLAGS_sumversion.o = -I$(srctree)/include/elf -HOSTCFLAGS_symsearch.o = -I$(srctree)/include/elf +HOSTCFLAGS_modpost.o = -I$(srctree)/include/elf -I$(srctree)/include/byteswap +HOSTCFLAGS_file2alias.o = -I$(srctree)/include/elf -I$(srctree)/include/byteswap +HOSTCFLAGS_sumversion.o = -I$(srctree)/include/elf -I$(srctree)/include/byteswap +HOSTCFLAGS_symsearch.o = -I$(srctree)/include/elf -I$(srctree)/include/byteswap HOSTCFLAGS_mk_elfconfig.o = -I$(srctree)/include/elf $(obj)/$(devicetable-offsets-file): $(obj)/devicetable-offsets.s FORCE