lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240807-macos-build-support-v1-10-4cd1ded85694@samsung.com>
Date: Wed, 07 Aug 2024 01:09:24 +0200
From: Daniel Gomez via B4 Relay <devnull+da.gomez.samsung.com@...nel.org>
To: Masahiro Yamada <masahiroy@...nel.org>, 
 Nathan Chancellor <nathan@...nel.org>, Nicolas Schier <nicolas@...sle.eu>, 
 Lucas De Marchi <lucas.demarchi@...el.com>, 
 Thomas Hellström <thomas.hellstrom@...ux.intel.com>, 
 Rodrigo Vivi <rodrigo.vivi@...el.com>, 
 Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>, 
 Maxime Ripard <mripard@...nel.org>, Thomas Zimmermann <tzimmermann@...e.de>, 
 David Airlie <airlied@...il.com>, Daniel Vetter <daniel@...ll.ch>, 
 William Hubbs <w.d.hubbs@...il.com>, Chris Brannon <chris@...-brannons.com>, 
 Kirk Reiser <kirk@...sers.ca>, 
 Samuel Thibault <samuel.thibault@...-lyon.org>, 
 Paul Moore <paul@...l-moore.com>, 
 Stephen Smalley <stephen.smalley.work@...il.com>, 
 Ondrej Mosnacek <omosnace@...hat.com>, 
 Catalin Marinas <catalin.marinas@....com>, Will Deacon <will@...nel.org>, 
 Marc Zyngier <maz@...nel.org>, Oliver Upton <oliver.upton@...ux.dev>, 
 James Morse <james.morse@....com>, 
 Suzuki K Poulose <suzuki.poulose@....com>, 
 Zenghui Yu <yuzenghui@...wei.com>, 
 Greg Kroah-Hartman <gregkh@...uxfoundation.org>, 
 Jiri Slaby <jirislaby@...nel.org>, 
 Nick Desaulniers <ndesaulniers@...gle.com>, 
 Bill Wendling <morbo@...gle.com>, Justin Stitt <justinstitt@...gle.com>
Cc: linux-kernel@...r.kernel.org, linux-kbuild@...r.kernel.org, 
 intel-xe@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org, 
 speakup@...ux-speakup.org, selinux@...r.kernel.org, 
 linux-arm-kernel@...ts.infradead.org, kvmarm@...ts.linux.dev, 
 linux-serial@...r.kernel.org, llvm@...ts.linux.dev, 
 Finn Behrens <me@...enk.dev>, 
 "Daniel Gomez (Samsung)" <d+samsung@...ces.com>, gost.dev@...sung.com, 
 Daniel Gomez <da.gomez@...sung.com>
Subject: [PATCH 10/12] scripts/mod: add byteswap support

From: Daniel Gomez <da.gomez@...sung.com>

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 <features.h>
-
-/* Get the machine specific, optimized definitions.  */
-#include <bits/byteswap.h>
-

 /* 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 <da.gomez@...sung.com>
---
 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
+   <https://www.gnu.org/licenses/>.  */
+
+#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

-- 
Git-146)



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ